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

Function TEST

ExcaliburHashTest04.cpp:53–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51};
52
53TEST(SmFlatHashMap, InsertFromItselfWhileGrow)
54{
55 for (int i = 1; i <= 1000; i++)
56 {
57 // printf("Step %d\n", i);
58
59 // create hash map and insert one element
60 Excalibur::HashTable<int, ComplexValue> ht;
61
62 // insert some elements into the hash maps
63 for (int j = 0; j < i; j++)
64 {
65 ht.emplace(j, ComplexValue{});
66 }
67
68 // find the first inserted element (get a valid iterator)
69 auto it = ht.find(0);
70 ASSERT_NE(it, ht.end());
71
72 // insert a new element using the above iterator
73 // (a hash map can grow during insertion and this could invalidate the iterator)
74 ht.emplace(-1, it->second);
75
76 auto it2 = ht.find(-1);
77 ASSERT_NE(it2, ht.end());
78 }
79}
80
81TEST(SmFlatHashMap, CopyableIterators)
82{

Callers

nothing calls this directly

Calls 2

endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected