ReactOS 0.4.15-dev-7953-g1f49173
ihateeh.cxx File Reference
#include <stdlib.h>
#include <stdio.h>
Include dependency graph for ihateeh.cxx:

Go to the source code of this file.

Classes

class  B
 
class  A< T1 >
 

Macros

#define FALSE   0
 
#define TRUE   1
 
#define NO_CTOR_THROW   1
 
#define NO_DTOR_THROW   2
 
#define TEST_DTOR
 
#define MAX_OBJECTS   500
 
#define NOEXCEPT(_x)
 

Functions

void FAIL (int i)
 
void dealloc (int i, int no_throw)
 
void alloc (int i, int no_throw)
 
A foo (A a1, A a2)
 
int bar ()
 
void foo2 (int i, A a1, A a2, A a3)
 
A test ()
 
int main ()
 

Variables

int Object [MAX_OBJECTS]
 
int CurrentObjectNumber
 
int ThrowCount
 
int MaxObjectCount = 1
 
int Fail
 

Macro Definition Documentation

◆ FALSE

#define FALSE   0

Definition at line 8 of file ihateeh.cxx.

◆ MAX_OBJECTS

#define MAX_OBJECTS   500

Definition at line 15 of file ihateeh.cxx.

◆ NO_CTOR_THROW

#define NO_CTOR_THROW   1

Definition at line 10 of file ihateeh.cxx.

◆ NO_DTOR_THROW

#define NO_DTOR_THROW   2

Definition at line 11 of file ihateeh.cxx.

◆ NOEXCEPT

#define NOEXCEPT (   _x)

Definition at line 17 of file ihateeh.cxx.

◆ TEST_DTOR

#define TEST_DTOR

Definition at line 13 of file ihateeh.cxx.

◆ TRUE

#define TRUE   1

Definition at line 9 of file ihateeh.cxx.

Function Documentation

◆ alloc()

void alloc ( int  i,
int  no_throw 
)

Definition at line 44 of file ihateeh.cxx.

44 {
47
48 /* Object already exists? */
49 if (Object[i])
50 FAIL(i);
51
52 /* Try throw in this ctor.. */
53 if (i == ThrowCount && !no_throw) {
54 printf("Throwing\n");
55 throw(1);
56 }
57
58 if (i >= MAX_OBJECTS) {
59 printf("\n*** Number of objects exceeded. Increase MAX_OBJECTS ***\n\n");
60 FAIL(i);
61 i = 0;
62 }
63
64 Object[i] = 1;
65}
#define printf
Definition: freeldr.h:97
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
void FAIL(int i)
Definition: ihateeh.cxx:23
int MaxObjectCount
Definition: ihateeh.cxx:20
int CurrentObjectNumber
Definition: ihateeh.cxx:20
#define MAX_OBJECTS
Definition: ihateeh.cxx:15
int ThrowCount
Definition: ihateeh.cxx:20
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

◆ bar()

int bar ( )

Definition at line 135 of file ihateeh.cxx.

135 {
136 A a;
137
138 return 666;
139}
Definition: ehthrow.cxx:93
#define a
Definition: ke_i.h:78

◆ dealloc()

void dealloc ( int  i,
int  no_throw 
)

Definition at line 28 of file ihateeh.cxx.

28 {
29 /* Make sure i is valid, and object exists */
30 if (i < 0 || i >= MaxObjectCount || !Object[i])
31 FAIL(i);
32
33 Object[i] = 0;
34
35/* Try throw in this dtor.. */
36#ifdef TEST_DTOR
37 if (i + MaxObjectCount == ThrowCount && !no_throw) {
38 printf("Throwing\n");
39 throw(1);
40 }
41#endif
42}

◆ FAIL()

void FAIL ( int  i)

Definition at line 23 of file ihateeh.cxx.

23 {
24 printf("FAILED on %d\n", i);
25 Fail++;
26}
int Fail
Definition: ihateeh.cxx:21

Referenced by alloc(), and dealloc().

◆ foo()

A foo ( A  a1,
A  a2 
)

Definition at line 133 of file ihateeh.cxx.

133{ return a1 + a2; };
static const struct update_accum a1
Definition: msg.c:578
static const struct update_accum a2
Definition: msg.c:586

◆ foo2()

void foo2 ( int  i,
A  a1,
A  a2,
A  a3 
)

Definition at line 141 of file ihateeh.cxx.

141 {
142 if (i != 666)
143 FAIL(666);
144 foo(a1, a3);
145}
static const struct update_accum a3
Definition: msg.c:600

Referenced by test().

◆ main()

int main ( void  )

Definition at line 167 of file ihateeh.cxx.

167 {
168 int i;
169
170 /* Call test(), with a different ctor/dtor throwing each time */
171 for (ThrowCount = 0; ThrowCount < MaxObjectCount * 2; ThrowCount++) {
172 printf("ThrowCount = %d MaxObjectCount = %d\n", ThrowCount,
174
176
177 try {
178 test();
179 } catch (int) {
180 printf("In catch\n");
181 }
182
183 /* Any objects which didn't get dtor'd? */
184 for (i = 0; i < MaxObjectCount; i++) {
185 if (Object[i]) {
186 FAIL(i);
187 Object[i] = 0;
188 }
189 }
190
191 printf("\n");
192 }
193
194 printf("\n");
195 if (Fail)
196 printf("FAILED %d tests\n", Fail);
197 else
198 printf("Passed\n");
199}
A test()
Definition: ihateeh.cxx:147

◆ test()

A test ( )

Definition at line 147 of file ihateeh.cxx.

147 {
148 puts("Try simple ctor");
149 A a1;
150
151 puts("Try question op ctor");
152 A a2 = (ThrowCount & 1) ? A() : ThrowCount;
153
154 puts("Try a more complex question op ctor");
155 A a3 = (ThrowCount & 1) ? A() + a1 + A() + a2 : a2 + A() + A() + ThrowCount;
156
157 puts("Try mbarg copy ctors, and return UDT");
158 A a4 = foo(a1, a2);
159
160 puts("Try a more complex mbarg copy ctors, and a function call");
161 foo2(bar(), a1 + a2, a2 + A() + a3 + a4, a3);
162
163 puts("Try temporary expressions, and return UDT");
164 return a1 + A() + a2 + A() + a3 + a4;
165}
int puts(const char *string)
Definition: crtsupp.c:23
#define A(row, col)
void foo2(int i, A a1, A a2, A a3)
Definition: ihateeh.cxx:141
int bar()
Definition: ihateeh.cxx:135
static const struct update_accum a4
Definition: msg.c:2285

Variable Documentation

◆ CurrentObjectNumber

int CurrentObjectNumber

Definition at line 20 of file ihateeh.cxx.

Referenced by alloc().

◆ Fail

int Fail

Definition at line 21 of file ihateeh.cxx.

Referenced by FAIL().

◆ MaxObjectCount

int MaxObjectCount = 1

Definition at line 20 of file ihateeh.cxx.

Referenced by alloc(), and dealloc().

◆ Object

Definition at line 19 of file ihateeh.cxx.

◆ ThrowCount

int ThrowCount

Definition at line 20 of file ihateeh.cxx.

Referenced by alloc(), dealloc(), main(), and test().