ReactOS  0.4.14-dev-552-g2fad488
CSimpleArray.cpp File Reference
#include "atltest.h"
#include <atlbase.h>
#include <atlsimpcoll.h>
Include dependency graph for CSimpleArray.cpp:

Go to the source code of this file.

Classes

struct  CCreature
 

Functions

 START_TEST (CSimpleArray)
 

Function Documentation

◆ START_TEST()

START_TEST ( CSimpleArray  )

Definition at line 44 of file CSimpleArray.cpp.

45 {
46  CSimpleArray<int> array1;
47 
48  ok_int(array1.GetSize(), 0);
49 
50  array1.Add(123);
51 
52  ok_int(array1.GetSize(), 1);
53  ok_int(array1.GetData()[0], 123);
54  ok_int(array1[0], 123);
55 
56  array1.Add(456);
57 
58  ok_int(array1.GetSize(), 2);
59  ok_int(array1.GetData()[0], 123);
60  ok_int(array1[0], 123);
61  ok_int(array1.GetData()[1], 456);
62  ok_int(array1[1], 456);
63 
64  array1.RemoveAll();
65  ok_int(array1.GetSize(), 0);
66 
67  array1.Add(1);
68  array1.Add(1);
69  array1.Add(1);
70  array1.Add(2);
71  array1.Add(2);
72  array1.Add(3);
73  ok_int(array1.GetSize(), 6);
74 
75  array1.Remove(2);
76  ok_int(array1.GetSize(), 5);
77 
78  array1.Remove(1);
79  ok_int(array1.GetSize(), 4);
80 
81  ok_int(array1[0], 1);
82  ok_int(array1[1], 1);
83  ok_int(array1[2], 2);
84  ok_int(array1[3], 3);
85 
88 
90  {
91  CCreature creature1, creature2;
92 
95  array2.Add(creature1);
98  array2.Add(creature2);
101  }
104 
105  {
106  CSimpleArray<CCreature> array3(array2), array4, array5;
109 
110  array4 = array2;
113 
114  CCreature creature1;
117 
118  array4.Add(creature1);
121 
122  array3 = array4;
125 
126  array5 = array2;
129 
130  array5 = array2;
133  }
136 
137  array2.RemoveAll();
140 
141  array1.RemoveAll();
142  ok_int(array1.GetSize(), 0);
143  for (int i = 0; i < 100; ++i)
144  {
145  array1.Add(i);
146  }
147  ok_int(array1.GetSize(), 100);
148 
149  array1.RemoveAll();
150  ok_int(array1.GetSize(), 0);
151  array1.Add(123);
152  array1.Add(321);
153  ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
154  ok_int(array1.GetSize(), 1);
155  if (array1.GetSize() == 1)
156  {
157  ok_int(array1[0], 321);
158  }
159  ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
160  ok_int(array1.GetSize(), 0);
161 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok_int(expression, result)
Definition: atltest.h:134
static int s_nCopyCount
#define ok(value,...)
Definition: atltest.h:57
static int s_nCount