ReactOS  0.4.15-dev-1039-gb9754fa
test_hash_map.cpp File Reference
#include "Tests.h"
#include "TestClass.h"
#include "LeakCheck.h"
#include <hash_map>
#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_map.cpp:

Go to the source code of this file.

Typedefs

typedef EH_STD::__hash_multimap__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMultiMap
 
typedef EH_STD::__hash_map__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMap
 

Functions

multimap_tag container_category (const TestMultiMap &)
 
void test_hash_multimap ()
 
map_tag container_category (const TestMap &)
 
void test_hash_map ()
 

Typedef Documentation

◆ TestMap

◆ TestMultiMap

Function Documentation

◆ container_category() [1/2]

multimap_tag container_category ( const TestMultiMap )
inline

Definition at line 42 of file test_hash_map.cpp.

42  {
43  return multimap_tag();
44 }

◆ container_category() [2/2]

map_tag container_category ( const TestMap )
inline

Definition at line 88 of file test_hash_map.cpp.

89 {
90  return map_tag();
91 }

◆ 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().