MCPcopy Create free account
hub / github.com/SergeyMakeev/SlotMap / TEST

Function TEST

SlotMapTest04.cpp:7–34  ·  view source on GitHub ↗

Note: You could run "SlotMapTest --gtest_filter=SlotMapTest.PageDeactivationOnClear" if you need to run only a specific test

Source from the content-addressed store, hash-verified

5
6// Note: You could run "SlotMapTest --gtest_filter=SlotMapTest.PageDeactivationOnClear" if you need to run only a specific test
7TEST(SlotMapTest, IdsToAssociativeContainers64)
8{
9 dod::slot_map64<int> slotMap;
10
11 std::unordered_map<dod::slot_map64<int>::key, int> unorderedMap;
12 std::map<dod::slot_map64<int>::key, int> map;
13
14 for (int i = 0; i < 128; i++)
15 {
16 auto id = slotMap.emplace(i);
17 unorderedMap.emplace(std::make_pair(id, i));
18 map.emplace(std::make_pair(id, i));
19 }
20 EXPECT_EQ(slotMap.size(), 128u);
21 EXPECT_EQ(unorderedMap.size(), size_t(128));
22 EXPECT_EQ(map.size(), size_t(128));
23
24 for (const auto& [key, value] : slotMap.items())
25 {
26 auto uit = unorderedMap.find(key);
27 ASSERT_NE(uit, unorderedMap.end());
28 ASSERT_EQ(uit->second, value);
29
30 auto it = map.find(key);
31 ASSERT_NE(it, map.end());
32 ASSERT_EQ(it->second, value);
33 }
34}
35
36TEST(SlotMapTest, IdsToAssociativeContainers32)
37{

Callers

nothing calls this directly

Calls 11

emplaceMethod · 0.80
sizeMethod · 0.80
itemsMethod · 0.80
clearMethod · 0.80
emptyMethod · 0.80
getMethod · 0.80
has_keyMethod · 0.80
popMethod · 0.80
eraseMethod · 0.80
debug_statsMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected