ReactOS 0.4.16-dev-258-g81860b4
test_hash_set.cpp File Reference
#include "Tests.h"
#include <hash_set>
#include "TestClass.h"
#include "LeakCheck.h"
#include "test_construct.h"
#include "test_assign_op.h"
#include "test_push_back.h"
#include "test_insert.h"
#include "test_push_front.h"
#include "ThrowCompare.h"
#include "test_hash_resize.h"
Include dependency graph for test_hash_set.cpp:

Go to the source code of this file.

Typedefs

typedef EH_STD::__hash_multiset__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiSet
 
typedef EH_STD::__hash_set__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestSet
 

Functions

multiset_tag container_category (const TestMultiSet &)
 
void test_hash_multiset ()
 
set_tag container_category (const TestSet &)
 
void test_hash_set ()
 

Typedef Documentation

◆ TestMultiSet

◆ TestSet

Function Documentation

◆ container_category() [1/2]

multiset_tag container_category ( const TestMultiSet )
inline

Definition at line 36 of file test_hash_set.cpp.

37{
38 return multiset_tag();
39}

◆ container_category() [2/2]

set_tag container_category ( const TestSet )
inline

Definition at line 83 of file test_hash_set.cpp.

84{
85 return set_tag();
86}

◆ 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 )
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 ConstCheck(const Value &v, const Operation &op, long max_iters=2000000)
Definition: LeakCheck.h:103
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
unsigned random_number(size_t range)
unsigned random_base
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

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
124# endif
125}
static void testSet(void)
Definition: env.c:170
EH_STD::__hash_set__< TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestSet

Referenced by main().