ReactOS 0.4.15-dev-8096-ga0eec98
CAtlArray.cpp File Reference
#include "atltest.h"
#include <atlbase.h>
#include <atlcoll.h>
Include dependency graph for CAtlArray.cpp:

Go to the source code of this file.

Classes

struct  CCreature
 

Functions

 START_TEST (CAtlArray)
 

Function Documentation

◆ START_TEST()

START_TEST ( CAtlArray  )

Definition at line 59 of file CAtlArray.cpp.

60{
61 {
63
69
70 array1.SetCount(2);
71
77
78 array1.SetCount(1);
79
85
86 CCreature test(111);
87
93
94 ok_size_t(array1.GetCount(), 1u);
95 ok_int(array1[0].m_id, 0x123456);
96 ok_int(array1.GetAt(0).m_id, 0x123456);
97
98 array1.Add(test);
99
105
106 ok_size_t(array1.GetCount(), 2u);
107 ok_int(array1[0].m_id, 0x123456);
108 ok_int(array1.GetAt(0).m_id, 0x123456);
109 ok_int(array1[1].m_id, 111);
110 ok_int(array1.GetAt(1).m_id, 111);
111
112 test.m_id = 222;
113 array1[0] = test;
114
120
121 // Default traits does not call anything when relocating objects!
122 array1.SetCount(100);
123
129
130 // Does not compile:
131 //CAtlArray<CCreature> array2(array1);
132
133 // Does not compile:
134 //CAtlArray<CCreature> array2;
135 //array2 = array1;
136 }
137
138 // Objects are cleaned up when the list goes away
144}
#define ok_size_t(expression, result)
Definition: atltest.h:115
#define ok_int(expression, result)
Definition: atltest.h:134
size_t Add(INARGTYPE element)
Definition: atlcoll.h:295
size_t GetCount() const
Definition: atlcoll.h:373
E & GetAt(size_t iElement)
Definition: atlcoll.h:395
bool SetCount(size_t nNewSize, int nGrowBy=- 1)
Definition: atlcoll.h:325
#define test
Definition: rosglue.h:37
static int s_nCtorCount
Definition: CAtlArray.cpp:20
static int s_nOpIsCount
Definition: CAtlArray.cpp:24
static int s_nCtorCount_Default
Definition: CAtlArray.cpp:21
static int s_nDtorCount
Definition: CAtlArray.cpp:23
static int s_nCCtorCount
Definition: CAtlArray.cpp:22