ReactOS  0.4.15-dev-1039-gb9754fa
test_map.cpp File Reference
#include "Tests.h"
#include "TestClass.h"
#include "LeakCheck.h"
#include <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 dependency graph for test_map.cpp:

Go to the source code of this file.

Typedefs

typedef EH_STD::__multimap__< TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiMap
 
typedef EH_STD::__map__< TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMap
 

Functions

template<class K , class V , class Comp , class A >
multimap_tag container_category (const EH_STD::__multimap__< K, V, Comp, A > &)
 
template<class K , class V , class Comp , class A >
map_tag container_category (const EH_STD::__map__< K, V, Comp, A > &)
 
void test_multimap ()
 
void CheckInvariant (const TestMap &m)
 
void test_map ()
 

Typedef Documentation

◆ TestMap

◆ TestMultiMap

Function Documentation

◆ CheckInvariant()

void CheckInvariant ( const TestMap m)

Definition at line 90 of file test_map.cpp.

91 {
92 // assert( map.__rb_verify() );
93  size_t total = 0;
94  EH_DISTANCE( m.begin(), m.end(), total );
95  assert( m.size() == total );
96 }
#define assert(x)
Definition: debug.h:53
const GLfloat * m
Definition: glext.h:10848
#define EH_DISTANCE(a, b, result)
Definition: Prefix.h:98

◆ container_category() [1/2]

template<class K , class V , class Comp , class A >
multimap_tag container_category ( const EH_STD::__multimap__< K, V, Comp, A > &  )
inline

Definition at line 36 of file test_map.cpp.

37 {
38  return multimap_tag();
39 }

◆ container_category() [2/2]

template<class K , class V , class Comp , class A >
map_tag container_category ( const EH_STD::__map__< K, V, Comp, A > &  )
inline

Definition at line 43 of file test_map.cpp.

44 {
45  return map_tag();
46 }

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