ReactOS 0.4.15-dev-7942-gd23573b
ConfigTest Class Reference
Inheritance diagram for ConfigTest:
Collaboration diagram for ConfigTest:

Protected Member Functions

void placement_new_bug ()
 
void endianess ()
 
void template_function_partial_ordering ()
 
void new_throw_bad_alloc ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (ConfigTest)
 
 CPPUNIT_TEST (placement_new_bug)
 
 CPPUNIT_TEST (endianess)
 
 CPPUNIT_TEST (template_function_partial_ordering)
 
 CPPUNIT_TEST (new_throw_bad_alloc)
 
 CPPUNIT_TEST_SUITE_END ()
 

Private Attributes

 CPPUNIT_IGNORE
 

Detailed Description

Definition at line 13 of file config_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/4]

ConfigTest::CPPUNIT_TEST ( endianess  )
private

◆ CPPUNIT_TEST() [2/4]

ConfigTest::CPPUNIT_TEST ( new_throw_bad_alloc  )
private

◆ CPPUNIT_TEST() [3/4]

ConfigTest::CPPUNIT_TEST ( placement_new_bug  )
private

◆ CPPUNIT_TEST() [4/4]

ConfigTest::CPPUNIT_TEST ( template_function_partial_ordering  )
private

◆ CPPUNIT_TEST_SUITE()

ConfigTest::CPPUNIT_TEST_SUITE ( ConfigTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

ConfigTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ endianess()

void ConfigTest::endianess ( )
protected

Definition at line 52 of file config_test.cpp.

53{
54#if defined (STLPORT)
55 int val = 0x01020304;
56 char *ptr = (char*)(&val);
57# if defined (_STLP_BIG_ENDIAN)
58 //This test only work if sizeof(int) == 4, this is a known limitation
59 //that will be handle the day we find a compiler for which it is false.
60 CPPUNIT_ASSERT( *ptr == 0x01 ||
61 sizeof(int) > 4 && *ptr == 0x00 );
62# elif defined (_STLP_LITTLE_ENDIAN)
63 CPPUNIT_ASSERT( *ptr == 0x04 );
64# endif
65#endif
66}
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLfloat * val
Definition: glext.h:7180
static PVOID ptr
Definition: dispmode.c:27

◆ new_throw_bad_alloc()

void ConfigTest::new_throw_bad_alloc ( )
protected

Definition at line 88 of file config_test.cpp.

89{
90#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
91 try
92 {
93 /* We try to exhaust heap memory. However, we don't actually use the
94 largest possible size_t value bus slightly less in order to avoid
95 triggering any overflows due to the allocator adding some more for
96 its internal data structures. */
97 size_t const huge_amount = size_t(-1) - 1024;
98 void* pvoid = operator new (huge_amount);
99#if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
100 // Allocation should have fail
101 CPPUNIT_ASSERT( pvoid != 0 );
102#endif
103 // Just in case it succeeds:
104 operator delete(pvoid);
105 }
106 catch (const bad_alloc&)
107 {
108#if defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
109 // Looks like your compiler new operator finally throw bad_alloc, you can fix
110 // configuration.
112#endif
113 }
114 catch (...)
115 {
116 //We shouldn't be there:
117 //Not bad_alloc exception thrown.
119 }
120#endif
121}
#define CPPUNIT_FAIL
Definition: cppunit_mini.h:206
__kernel_size_t size_t
Definition: linux.h:237

◆ placement_new_bug()

void ConfigTest::placement_new_bug ( )
protected

Definition at line 37 of file config_test.cpp.

38{
39#if defined (STLPORT)
40 int int_val = 1;
41 int *pint;
42 pint = new(&int_val) int();
43 CPPUNIT_ASSERT( pint == &int_val );
44# if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
45 CPPUNIT_ASSERT( int_val != 0 );
46# else
47 CPPUNIT_ASSERT( int_val == 0 );
48# endif
49#endif
50}

◆ template_function_partial_ordering()

void ConfigTest::template_function_partial_ordering ( )
protected

Definition at line 68 of file config_test.cpp.

69{
70#if defined (STLPORT)
71 vector<int> vect1(10, 0);
72 int* pvect1Front = &vect1.front();
73 vector<int> vect2(10, 0);
74 int* pvect2Front = &vect2.front();
75
76 swap(vect1, vect2);
77
78# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
79 CPPUNIT_ASSERT( pvect1Front == &vect2.front() );
80 CPPUNIT_ASSERT( pvect2Front == &vect1.front() );
81# else
82 CPPUNIT_ASSERT( pvect1Front != &vect2.front() );
83 CPPUNIT_ASSERT( pvect2Front != &vect1.front() );
84# endif
85#endif
86}
#define swap(a, b)
Definition: qsort.c:63

Member Data Documentation

◆ CPPUNIT_IGNORE

ConfigTest::CPPUNIT_IGNORE
private

Definition at line 17 of file config_test.cpp.


The documentation for this class was generated from the following file: