MCPcopy Create free account
hub / github.com/catboost/catboost / DoTestMMap1

Function DoTestMMap1

util/generic/map_ut.cpp:70–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68
69 template <typename TAlloc>
70 void DoTestMMap1(TMultiMap<char, int, TLess<char>, TAlloc>& m) {
71 using mmap = TMultiMap<char, int, TLess<char>, TAlloc>;
72
73 UNIT_ASSERT(m.count('X') == 0);
74
75 m.insert(std::pair<const char, int>('X', 10)); // Standard way.
76 UNIT_ASSERT(m.count('X') == 1);
77
78 m.insert(std::pair<const char, int>('X', 20)); // jbuck: standard way
79 UNIT_ASSERT(m.count('X') == 2);
80
81 m.insert(std::pair<const char, int>('Y', 32)); // jbuck: standard way
82 typename mmap::iterator i = m.find('X'); // Find first match.
83 ++i;
84 UNIT_ASSERT((*i).first == 'X');
85 UNIT_ASSERT((*i).second == 20);
86 ++i;
87 UNIT_ASSERT((*i).first == 'Y');
88 UNIT_ASSERT((*i).second == 32);
89 ++i;
90 UNIT_ASSERT(i == m.end());
91
92 size_t count = m.erase('X');
93 UNIT_ASSERT(count == 2);
94 }
95
96 Y_UNIT_TEST(TestMMap2) {
97 using pair_type = std::pair<const int, char>;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 5

countMethod · 0.45
insertMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected