MCPcopy Create free account
hub / github.com/defold/defold / hash_map_test

Function hash_map_test

engine/dlib/src/basis/transcoder/basisu_containers_impl.h:182–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180 }
181
182 void hash_map_test()
183 {
184 {
185 basisu::hash_map<uint64_t, uint64_t> k;
186 basisu::hash_map<uint64_t, uint64_t> l;
187 std::swap(k, l);
188
189 k.begin();
190 k.end();
191 k.clear();
192 k.empty();
193 k.erase(0);
194 k.insert(0, 1);
195 k.find(0);
196 k.get_equals();
197 k.get_hasher();
198 k.get_table_size();
199 k.reset();
200 k.reserve(1);
201 k = l;
202 k.set_equals(l.get_equals());
203 k.set_hasher(l.get_hasher());
204 k.get_table_size();
205 }
206
207 uint32_t seed = 0;
208 for (; ; )
209 {
210 seed++;
211
212 typedef basisu::hash_map<counted_obj, counted_obj> my_hash_map;
213 my_hash_map m;
214
215 const uint32_t n = irand32(0, 100000);
216
217 printf("%u\n", n);
218
219 srand(seed); // r1.seed(seed);
220
221 basisu::vector<int> q;
222
223 uint32_t count = 0;
224 for (uint32_t i = 0; i < n; i++)
225 {
226 uint32_t v = urand32() & 0x7FFFFFFF;
227 my_hash_map::insert_result res = m.insert(counted_obj(v), counted_obj(v ^ 0xdeadbeef));
228 if (res.second)
229 {
230 count++;
231 q.push_back(v);
232 }
233 }
234
235 HASHMAP_TEST_VERIFY(m.size() == count);
236
237 srand(seed);
238
239 my_hash_map cm(m);

Callers

nothing calls this directly

Calls 15

swapFunction · 0.85
irand32Function · 0.85
urand32Function · 0.85
counted_objClass · 0.85
get_table_sizeMethod · 0.80
set_equalsMethod · 0.80
set_hasherMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected