ReactOS  0.4.15-dev-499-g1f31905
CAtlArray.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE: Test for CAtlArray
5  * COPYRIGHT: Copyright 2016-2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6  * Copyright 2019 Mark Jansen (mark.jansen@reactos.org)
7  */
8 
9 #ifdef HAVE_APITEST
10  #include <apitest.h>
11 #else
12  #include "atltest.h"
13 #endif
14 
15 #include <atlbase.h>
16 #include <atlcoll.h>
17 
18 struct CCreature
19 {
20  static int s_nCtorCount;
22  static int s_nCCtorCount;
23  static int s_nDtorCount;
24  static int s_nOpIsCount;
25 
26  int m_id;
27 
28  CCreature(int id = 0x123456)
29  :m_id(id)
30  {
32  if (id == 0x123456)
34  }
36  :m_id(c.m_id)
37  {
39  }
41  {
43  }
45  {
46  m_id = other.m_id;
48  return *this;
49  }
50 };
51 
57 
58 
60 {
61  {
62  CAtlArray<CCreature> array1;
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 }
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 * u
Definition: glfuncs.h:240
CCreature & operator=(const CCreature &other)
Definition: CAtlArray.cpp:44
bool SetCount(size_t nNewSize, int nGrowBy=- 1)
Definition: atlcoll.h:325
int other
Definition: msacm.c:1376
static int s_nOpIsCount
Definition: CAtlArray.cpp:24
#define test
Definition: rosglue.h:37
CCreature(const CCreature &c)
Definition: CAtlArray.cpp:35
CCreature(int id=0x123456)
Definition: CAtlArray.cpp:28
static int s_nDtorCount
Definition: CAtlArray.cpp:23
size_t GetCount() const
Definition: atlcoll.h:373
E & GetAt(size_t iElement)
Definition: atlcoll.h:395
#define ok_int(expression, result)
Definition: atltest.h:134
size_t Add(INARGTYPE element)
Definition: atlcoll.h:295
const GLubyte * c
Definition: glext.h:8905
static int s_nCtorCount
Definition: CAtlArray.cpp:20
#define ok_size_t(expression, result)
Definition: atltest.h:115
static int s_nCtorCount_Default
Definition: CAtlArray.cpp:21
GLenum GLuint id
Definition: glext.h:5579
static int s_nCCtorCount
Definition: CAtlArray.cpp:22
START_TEST(CAtlArray)
Definition: CAtlArray.cpp:59