ReactOS  0.4.14-dev-52-g6116262
Tests.h File Reference
#include "Prefix.h"
Include dependency graph for Tests.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void test_algobase ()
 
void test_algo ()
 
void test_list ()
 
void test_map ()
 
void test_multimap ()
 
void test_set ()
 
void test_multiset ()
 
void test_vector ()
 
void test_deque ()
 
void test_bit_vector ()
 
void test_hash_map ()
 
void test_hash_multimap ()
 
void test_hash_set ()
 
void test_hash_multiset ()
 
void test_rope ()
 
void test_slist ()
 
void test_string ()
 

Function Documentation

◆ test_algo()

void test_algo ( )

Definition at line 248 of file test_algo.cpp.

249 {
250  SortBuffer mergeBuf;
251  mergeBuf.PrepareMerge();
252 
253  EH_STD::cerr<<"EH test : testing algo.h"<<EH_STD::endl;
254  WeakCheck( mergeBuf, test_inplace_merge_1( mergeBuf ) );
255  WeakCheck( mergeBuf, test_inplace_merge_2( mergeBuf ) );
256 
257  SortBuffer buf;
261 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
Definition: iostream.cpp:102
void PrepareMerge()
Definition: test_algo.cpp:48

Referenced by main().

◆ test_algobase()

void test_algobase ( )

Definition at line 90 of file test_algobase.cpp.

91 {
92  // force alignment
93  double arr[ sizeof(TestClass) * kBufferSize ];
94  TestClass* c = (TestClass*)arr;
98 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
const GLubyte * c
Definition: glext.h:8905

Referenced by main().

◆ test_bit_vector()

void test_bit_vector ( )

Definition at line 69 of file test_bit_vector.cpp.

70 {
71 #define __WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
72 
73  // Make some bit vectors to work with.
74  BitVector emptyVector;
75  BitVector testVector, testVector2;
76 
77  EH_ASSERT( testVector.size() == 0 );
78 
79  size_t BitVectorSize = random_number( random_base );
80  // Half the time, choose a size that will guarantee immediate reallocation
81  if ( random_number(2) )
82  BitVectorSize = BitVectorSize / __WORD_BIT * __WORD_BIT;
83 
84  EH_ASSERT( testVector.size() == 0 );
85  testVector.reserve(BitVectorSize);
86  EH_ASSERT( testVector.size() == 0 );
87  while (testVector.size() < BitVectorSize) {
88  testVector.push_back(random_number(2) != 0);
89  testVector2.push_back(random_number(2) != 0);
90  }
91 
92  // Test insertions
93  StrongCheck(testVector, test_insert_one<BitVector>(testVector) );
94  StrongCheck(testVector, test_insert_one<BitVector>(testVector,0) );
95  StrongCheck(testVector, test_insert_one<BitVector>(testVector, (int)testVector.size()) );
96 
98  StrongCheck(testVector, test_insert_n<BitVector>(testVector, random_number(random_base),0 ) );
99  StrongCheck(testVector, test_insert_n<BitVector>(testVector, random_number(random_base), (int)testVector.size()) );
100 #if 0
101  // Allocate some random bools to insert
102  size_t insCnt = 1 + random_number(random_base);
103  bool *insFirst = new BitVector::value_type[insCnt];
104  for (size_t n = 0; n < insCnt; n++)
105  insFirst[n] = random_number(2);
106  StrongCheck(testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt));
107  StrongCheck(testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt));
108  StrongCheck(testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt));
109  ConstCheck(0, test_construct_pointer_range<BitVector>( insFirst, insFirst + insCnt));
110  delete[] insFirst;
111 #endif
112  StrongCheck(testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end()));
113  StrongCheck(testVector, insert_range_at_begin_tester(testVector, testVector2.begin(),
114  testVector2.end()));
115  StrongCheck(testVector, insert_range_at_end_tester(testVector, testVector2.begin(),
116  testVector2.end()));
117  StrongCheck(testVector, test_BitVector_reserve( testVector.capacity() + random_number(50)));
118  StrongCheck(testVector, test_push_back<BitVector>(testVector));
119  StrongCheck(emptyVector, test_push_back<BitVector>(emptyVector));
120 
126  WeakCheck(testVector, test_assign_op<BitVector>(testVector2) );
127 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLdouble n
Definition: glext.h:7729
EH_BIT_VECTOR BitVector
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
#define EH_ASSERT
Definition: Prefix.h:37
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145
#define __WORD_BIT

Referenced by main().

◆ test_deque()

void test_deque ( )

Definition at line 47 of file test_deque.cpp.

48 {
49  size_t dequeSize = random_number(random_base);
50  TestDeque emptyDeque;
51  TestDeque testDeque, testDeque2;
52  while ( testDeque.size() < dequeSize )
53  {
54  DQTestClass x;
55  testDeque.push_back( x );
56  testDeque2.push_back( DQTestClass() );
57  }
58 
60  WeakCheck( testDeque, test_insert_one<TestDeque>(testDeque) );
61  StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, 0) );
62  StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, (int)testDeque.size()) );
63 
64  WeakCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base) ) );
65  StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), 0 ) );
66  StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), (int)testDeque.size() ) );
67 
68  size_t insCnt = random_number(random_base);
69  DQTestClass *insFirst = new TestDeque::value_type[insCnt + 1];
70 
71  WeakCheck( testDeque, insert_range_tester(testDeque, insFirst, insFirst + insCnt) );
72  StrongCheck( testDeque, insert_range_at_begin_tester(testDeque, insFirst, insFirst + insCnt) );
73  StrongCheck( testDeque, insert_range_at_end_tester(testDeque, insFirst, insFirst + insCnt) );
74 
75  ConstCheck( 0, test_construct_pointer_range<TestDeque>(insFirst, insFirst + insCnt) );
76  delete[] insFirst;
77 
78  WeakCheck( testDeque, insert_range_tester(testDeque, testDeque2.begin(), testDeque2.end() ) );
79 
80  StrongCheck( testDeque, test_push_back<TestDeque>(testDeque) );
81  StrongCheck( emptyDeque, test_push_back<TestDeque>(emptyDeque) );
82  StrongCheck( testDeque, test_push_front<TestDeque>(testDeque) );
83  StrongCheck( emptyDeque, test_push_front<TestDeque>(emptyDeque) );
84 
85 
90 
91  testDeque2.resize( testDeque.size() * 3 / 2 );
92  WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
93  testDeque2.resize( testDeque.size() * 2 / 3 );
94  WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
95 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)
EH_STD::deque< DQTestClass, eh_allocator(DQTestClass) > TestDeque
Definition: test_deque.cpp:39
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145
TestClass DQTestClass
Definition: test_deque.cpp:37

Referenced by main().

◆ test_hash_map()

void test_hash_map ( )

Definition at line 93 of file test_hash_map.cpp.

94 {
95 # if !(defined (_MSC_VER) && (_MSC_VER < 1100))
96  TestMap testMap, testMap2;
97 
98  const size_t hash_mapSize = random_number(random_base);
99 
100  while ( testMap.size() < hash_mapSize ) {
101  TestMap::value_type x;
102  testMap.insert( x );
103  testMap2.insert( TestMap::value_type() );
104  }
105 
106 #if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
107  WeakCheck( testMap, test_hash_resize<TestMap>() );
108  // TestMultiMap == TestMultiMap: no such operator! - ptr
109  // StrongCheck( testMap, test_insert_noresize<TestMap>(testMap) );
110 #endif
111  WeakCheck( testMap, test_insert_value<TestMap>(testMap) );
112 
113  size_t insCnt = random_number(random_base);
114  TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt];
115  WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) );
116  ConstCheck( 0, test_construct_pointer_range<TestMap>(insFirst, insFirst+insCnt) );
117  delete[] insFirst;
118 
119  WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) );
120 
122 # if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
124 # endif
126 
127  WeakCheck( testMap, test_assign_op<TestMap>( testMap2 ) );
128 # endif
129 }
EH_STD::__hash_map__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMap
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)

Referenced by main().

◆ test_hash_multimap()

void test_hash_multimap ( )

Definition at line 46 of file test_hash_map.cpp.

46  {
47 # if !(defined (_MSC_VER) && (_MSC_VER < 1100))
48  TestMultiMap testMultiMap, testMultiMap2;
49 
50  const size_t hash_mapSize = random_number(random_base);
51 
52  while ( testMultiMap.size() < hash_mapSize )
53  {
54  TestMultiMap::value_type x;
55  testMultiMap.insert( x );
56  testMultiMap2.insert( TestMultiMap::value_type() );
57  }
58 
59 # if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
60  WeakCheck( testMultiMap, test_hash_resize<TestMultiMap>() );
61  // TestMultiMap == TestMultiMap: no such operator! - ptr
62  // StrongCheck( testMultiMap, test_insert_noresize<TestMultiMap>(testMultiMap) );
63 # endif
64  WeakCheck( testMultiMap, test_insert_value<TestMultiMap>(testMultiMap) );
65 
66  size_t insCnt = random_number(random_base);
67  TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[1+insCnt];
68  WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) );
69  ConstCheck( 0, test_construct_pointer_range<TestMultiMap>(insFirst, insFirst+insCnt) );
70  delete[] insFirst;
71 
72  WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) );
73 
75 # if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
77 # endif
79 
80  WeakCheck( testMultiMap, test_assign_op<TestMultiMap>( testMultiMap2 ) );
81 # endif
82 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
EH_STD::__hash_multimap__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiMap
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)

Referenced by main().

◆ test_hash_multiset()

void test_hash_multiset ( )

Definition at line 41 of file test_hash_set.cpp.

42 {
43 # if !(defined (_MSC_VER) && (_MSC_VER < 1100))
44  TestMultiSet testMultiSet, testMultiSet2;
45 
46  const size_t hash_setSize = random_number(random_base);
47 
48  while ( testMultiSet.size() < hash_setSize )
49  {
50  TestMultiSet::value_type x;
51  testMultiSet.insert( x );
52  testMultiSet2.insert( TestMultiSet::value_type() );
53  }
54 
55 # if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
56  WeakCheck( testMultiSet, test_hash_resize<TestMultiSet>() );
57  // TestMultiSet == TestMultiSet: no such operator! - ptr
58  // StrongCheck( testMultiSet, test_insert_noresize<TestMultiSet>(testMultiSet) );
59 # endif
60  WeakCheck( testMultiSet, test_insert_value<TestMultiSet>(testMultiSet) );
61 
62  size_t insCnt = random_number(random_base);
63  TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt];
64  WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) );
65  ConstCheck( 0, test_construct_pointer_range<TestMultiSet>(insFirst, insFirst+insCnt) );
66  delete[] insFirst;
67 
68  WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) );
69 
71 # if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
73 # endif
75 
76  WeakCheck( testMultiSet, test_assign_op<TestMultiSet>( testMultiSet2 ) );
77 # endif
78 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
EH_STD::__hash_multiset__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiSet
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)

Referenced by main().

◆ test_hash_set()

void test_hash_set ( )

Definition at line 88 of file test_hash_set.cpp.

89 {
90 # if !(defined (_MSC_VER) && (_MSC_VER < 1100))
91  TestSet testSet, testSet2;
92 
93  const size_t hash_setSize = random_number(random_base);
94 
95  while ( testSet.size() < hash_setSize )
96  {
97  TestSet::value_type x;
98  testSet.insert( x );
99  testSet2.insert( TestSet::value_type() );
100  }
101 
102 # if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
104  // TestMultiSet == TestMultiSet: no such operator! - ptr
105  // StrongCheck( testSet, test_insert_noresize<TestSet>(testSet) );
106 # endif
108 
109  size_t insCnt = random_number(random_base);
110  TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
111  WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
112  ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
113  delete[] insFirst;
114 
115  WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
116 
118 # if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
120 # endif
122 
123  WeakCheck( testSet, test_assign_op<TestSet>( testSet2 ) );
124 # endif
125 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
EH_STD::__hash_set__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestSet
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
static void testSet(void)
Definition: env.c:170
unsigned random_number(size_t range)

Referenced by main().

◆ test_list()

Definition at line 64 of file test_list.cpp.

65 {
66  TestList testList, testList2;
67  size_t listSize = random_number(random_base);
68 
69  while ( testList.size() < listSize )
70  {
71  TestClass x;
72  testList.push_back( x );
73  testList2.push_back( TestClass() );
74  }
75 
76  StrongCheck( testList, test_insert_one<TestList>(testList) );
77  StrongCheck( testList, test_insert_one<TestList>(testList, 0) );
78  StrongCheck( testList, test_insert_one<TestList>(testList, (int)testList.size()) );
79 
81  WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), 0 ) );
82  WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), (int)testList.size() ) );
83 
84  size_t insCnt = random_number(random_base);
85  TestClass *insFirst = new TestList::value_type[1+insCnt];
86 
87  WeakCheck( testList, insert_range_tester(testList, insFirst, insFirst+insCnt) );
88  WeakCheck( testList, insert_range_at_begin_tester(testList, insFirst, insFirst+insCnt) );
89  WeakCheck( testList, insert_range_at_end_tester(testList, insFirst, insFirst+insCnt) );
90 
91  ConstCheck( 0, test_construct_pointer_range<TestList>(insFirst, insFirst+insCnt) );
92  delete[] insFirst;
93 
94  WeakCheck( testList, insert_range_tester(testList, testList2.begin(), testList2.end() ) );
95 
96  StrongCheck( testList, test_push_front<TestList>(testList) );
97  StrongCheck( testList, test_push_back<TestList>(testList) );
98 
99  StrongCheck( testList, test_list_sort() ); // Simply to verify strength.
100 
106 
107  WeakCheck( testList, test_assign_op<TestList>( testList2 ) );
108 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
EH_STD::__list__< TestClass, eh_allocator(TestClass) > TestList
Definition: test_list.cpp:31
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().

◆ test_map()

void test_map ( )

Definition at line 98 of file test_map.cpp.

99 {
100  TestMap testMap, testMap2;
101 
102  const size_t mapSize = random_number(random_base);
103 
104  while ( testMap.size() < mapSize )
105  {
106  TestMap::value_type x;
107  testMap.insert( x );
108  testMap2.insert( TestMap::value_type() );
109  }
110 
111  StrongCheck( testMap, test_insert_value<TestMap>(testMap) );
112 
113  size_t insCnt = random_number(random_base);
114  TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt];
115 
116  WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) );
117 
118  ConstCheck( 0, test_construct_pointer_range<TestMap>(insFirst, insFirst+insCnt) );
119  delete[] insFirst;
120 
121  WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) );
125  WeakCheck( testMap, test_assign_op<TestMap>( testMap2 ) );
126 }
EH_STD::__hash_map__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMap
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().

◆ test_multimap()

void test_multimap ( )

Definition at line 50 of file test_map.cpp.

51 {
52  TestMultiMap testMultiMap, testMultiMap2;
53 
54  const size_t mapSize = random_number(random_base);
55 
56  while ( testMultiMap.size() < mapSize )
57  {
58  TestMultiMap::value_type x;
59  testMultiMap.insert( x );
60  testMultiMap2.insert( TestMultiMap::value_type() );
61  }
62 
63  StrongCheck( testMultiMap, test_insert_value<TestMultiMap>(testMultiMap) );
64 
65  size_t insCnt = 1 + random_number(random_base);
66  TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[insCnt];
67 
68  WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) );
69 
70  ConstCheck( 0, test_construct_pointer_range<TestMultiMap>(insFirst, insFirst+insCnt) );
71  delete[] insFirst;
72 
73 
74  WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) );
75 
76 
78 
80 
82 
83  WeakCheck( testMultiMap, test_assign_op<TestMultiMap>( testMultiMap2 ) );
84 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
EH_STD::__hash_multimap__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiMap
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().

◆ test_multiset()

void test_multiset ( )

Definition at line 41 of file test_set.cpp.

41  {
42  TestMultiSet testMultiSet, testMultiSet2;
43 
44  const size_t setSize = random_number(random_base);
45 
46  while (testMultiSet.size() < setSize) {
47  TestMultiSet::value_type x;
48  testMultiSet.insert( x );
49  testMultiSet2.insert( TestMultiSet::value_type() );
50  }
51 
52  StrongCheck( testMultiSet, test_insert_value<TestMultiSet>(testMultiSet) );
53 
54  size_t insCnt = random_number(random_base);
55  TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt];
56  WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) );
57  ConstCheck( 0, test_construct_pointer_range<TestMultiSet>(insFirst, insFirst+insCnt) );
58  delete[] insFirst;
59  WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) );
60 
64 
65  WeakCheck( testMultiSet, test_assign_op<TestMultiSet>( testMultiSet2 ) );
66 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
EH_STD::__hash_multiset__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiSet
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().

◆ test_rope()

void test_rope ( )

Definition at line 49 of file test_rope.cpp.

50 {
51  TestRope testRope, testRope2;
52  size_t ropeSize = random_number(random_base);
53 
54  while ( testRope.size() < ropeSize )
55  {
56  TestRope::value_type x = TestRope::value_type(random_number(random_base)); // initialize before use
57  testRope.push_back( x );
58  testRope2.push_back( TestRope::value_type() );
59  }
60  WeakCheck( testRope, test_insert_one<TestRope>(testRope) );
61  WeakCheck( testRope, test_insert_one<TestRope>(testRope, 0) );
62  WeakCheck( testRope, test_insert_one<TestRope>(testRope, (int)testRope.size()) );
63 
65  WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), 0 ) );
66  WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), (int)testRope.size() ) );
67 
68  size_t insCnt = random_number(random_base);
69  TestRope::value_type *insFirst = new TestRope::value_type[1+insCnt];
70 
71  WeakCheck( testRope, insert_range_tester(testRope, insFirst, insFirst+insCnt) );
72  WeakCheck( testRope, insert_range_at_begin_tester(testRope, insFirst, insFirst+insCnt) );
73  WeakCheck( testRope, insert_range_at_end_tester(testRope, insFirst, insFirst+insCnt) );
74 
75  ConstCheck( 0, test_construct_pointer_range<TestRope>(insFirst, insFirst+insCnt) );
76  delete[] insFirst;
77 
78  WeakCheck( testRope, insert_range_tester(testRope, testRope2.begin(), testRope2.end() ) );
79 
80  WeakCheck( testRope, test_push_front<TestRope>(testRope) );
81  WeakCheck( testRope, test_push_back<TestRope>(testRope) );
82 
84 
85 // dwa 1/25/00 - not actually valid for rope, because it doesn't
86 // have the constructor in question! The code will compile, but with the
87 // wrong result (the constructor that gets used does something different).
88 
89 // ConstCheck( 0, test_construct_n<TestRope>( random_number(random_base) ) );
90 
94 
95  WeakCheck( testRope, test_assign_op<TestRope>( testRope2 ) );
96 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
STLPORT::rope< char, eh_allocator(char) > TestRope
Definition: test_rope.cpp:41
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)

Referenced by main().

◆ test_set()

void test_set ( )

Definition at line 75 of file test_set.cpp.

75  {
76  TestSet testSet, testSet2;
77 
78  const size_t setSize = random_number(random_base);
79 
80  while ( testSet.size() < setSize ) {
81  TestSet::value_type x;
82  testSet.insert( x );
83  testSet2.insert( TestSet::value_type() );
84  }
86 
87  size_t insCnt = random_number(random_base);
88  TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
89 
90  WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
91 
92  ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
93  delete[] insFirst;
94  WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
95 
100 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
EH_STD::__hash_set__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestSet
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
static void testSet(void)
Definition: env.c:170
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().

◆ test_slist()

void test_slist ( )

Definition at line 55 of file test_slist.cpp.

55  {
56  TestSList testSList, testSList2;
57  size_t slistSize = random_number(random_base);
58 
59  while (testSList.size() < slistSize) {
60  TestClass x;
61  testSList.push_front( x );
62  testSList2.push_front( TestClass() );
63  }
64 
65  StrongCheck( testSList, test_insert_one<TestSList>(testSList) );
66  StrongCheck( testSList, test_insert_one<TestSList>(testSList, 0) );
67  StrongCheck( testSList, test_insert_one<TestSList>(testSList, (int)testSList.size()) );
68 
69  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base) ) );
70  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), 0 ) );
71  WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), (int)testSList.size() ) );
72 
73  size_t insCnt = random_number(random_base);
74  TestClass *insFirst = new TestSList::value_type[1+insCnt];
75  WeakCheck( testSList, insert_range_tester(testSList, insFirst, insFirst+insCnt) );
76 
77  ConstCheck( 0, test_construct_pointer_range<TestSList>(insFirst, insFirst+insCnt) );
78  delete[] insFirst;
79  WeakCheck( testSList, test_insert_range<TestSList,TestSList::iterator>(testSList, testSList2.begin(), testSList2.end() ) );
80  StrongCheck( testSList, test_push_front<TestSList>(testSList) );
81  StrongCheck( testSList, test_slist_sort() ); // Simply to verify strength.
82 
88  WeakCheck( testSList, test_assign_op<TestSList>( testSList2 ) );
89 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
unsigned random_number(size_t range)
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145
EH_STD::__slist__< TestClass, eh_allocator(TestClass) > TestSList
Definition: test_slist.cpp:34

◆ test_string()

void test_string ( )

Definition at line 38 of file test_string.cpp.

38  {
39  TestString testString, testString2;
40  size_t ropeSize = random_number(random_base);
41 
42  while ( testString.size() < ropeSize ) {
43  TestString::value_type x = TestString::value_type(random_number(random_base)) ; // initialize before use
44  testString.append(1, x );
45  testString2.append(1, TestString::value_type() );
46  }
47  WeakCheck( testString, test_insert_one<TestString>(testString) );
48  WeakCheck( testString, test_insert_one<TestString>(testString, 0) );
49  WeakCheck( testString, test_insert_one<TestString>(testString, (int)testString.size()) );
50 
51  WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base) ) );
52  WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), 0 ) );
53  WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), (int)testString.size() ) );
54 
55  size_t insCnt = random_number(random_base);
56  TestString::value_type *insFirst = new TestString::value_type[1+insCnt];
57 
58  WeakCheck( testString, insert_range_tester(testString, insFirst, insFirst+insCnt) );
59  WeakCheck( testString, insert_range_at_begin_tester(testString, insFirst, insFirst+insCnt) );
60  WeakCheck( testString, insert_range_at_end_tester(testString, insFirst, insFirst+insCnt) );
61 
62  ConstCheck( 0, test_construct_pointer_range<TestString>(insFirst, insFirst+insCnt) );
63  delete[] insFirst;
64 
65  WeakCheck( testString, insert_range_tester(testString, testString2.begin(), testString2.end() ) );
66  /*
67  WeakCheck( testString, test_push_front<TestString>(testString) );
68  WeakCheck( testString, test_push_back<TestString>(testString) );
69  */
71  // requires _Reserve_t ConstCheck( 0, test_construct_n<TestString>( random_number(random_base) ) );
75 
76  WeakCheck( testString, test_assign_op<TestString>( testString2 ) );
77 }
EH_STD::basic_string< char, EH_STD::char_traits< char >, eh_allocator(char) > TestString
Definition: test_string.cpp:30
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)

Referenced by main(), test_callback(), test_convert(), test_EM_GETTEXTLENGTHEX(), test_propertytovariant(), test_readfileex_pending(), test_rsa_round_trip(), test_RtlUnicodeToUTF8N(), test_RtlUTF8ToUnicodeN(), and test_varianttoproperty().

◆ test_vector()

void test_vector ( )

Definition at line 74 of file test_vector.cpp.

75 {
76 
78 
79  TestVector emptyVector;
80  TestVector testVector, testVector2;
81  size_t vectorSize = random_number(random_base);
82 
83  testVector.reserve(vectorSize*4);
84  while ( testVector.size() < vectorSize )
85  {
86  TestClass x;
87  testVector.push_back( x );
88  testVector2.push_back( TestClass() );
89  }
90 
91  size_t insCnt = random_number(random_base);
92  TestClass *insFirst = new TestVector::value_type[1+ insCnt];
93 
94  ConstCheck( 0, test_construct_pointer_range<TestVector>(insFirst, insFirst+insCnt) );
95 
96  WeakCheck( testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt) );
97  WeakCheck( testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt) );
98  WeakCheck( testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt) );
99  delete[] insFirst;
100 
101  WeakCheck( testVector, test_insert_one<TestVector>(testVector) );
102  WeakCheck( testVector, test_insert_one<TestVector>(testVector, 0) );
103  WeakCheck( testVector, test_insert_one<TestVector>(testVector, (int)testVector.size()) );
104 
105  WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base) ) );
106  WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base), 0 ) );
107  WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base), (int)testVector.size() ) );
108 
109  WeakCheck( testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end() ) );
110 
111 
112  StrongCheck( testVector, test_reserve( testVector.capacity() + random_number(random_base) ) );
113  StrongCheck( testVector, test_push_back<TestVector>(testVector) );
114  StrongCheck( emptyVector, test_push_back<TestVector>(emptyVector) );
115 
120 
121  testVector2.resize( testVector.size() * 3 / 2 );
122  WeakCheck( testVector, test_assign_op<TestVector>( testVector2 ) );
123  testVector2.clear();
124  testVector2.resize( testVector.size() * 2 / 3 );
125  WeakCheck( testVector, test_assign_op<TestVector>( testVector2 ) );
126 }
void WeakCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:65
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
test_insert_range< C, Iter > insert_range_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:535
test_insert_range< C, Iter > insert_range_at_end_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:547
void ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
unsigned random_base
test_insert_range< C, Iter > insert_range_at_begin_tester(const C &orig, const Iter &first, const Iter &last)
Definition: test_insert.h:541
unsigned random_number(size_t range)
EH_STD::__vector__< TestClass, eh_allocator(TestClass) > TestVector
Definition: test_vector.cpp:33
void StrongCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:145

Referenced by main().