tests/test_hash_map.c

changeset 1442
244fb8bc3584
parent 1439
8e7fe85febc0
child 1443
6986e9ed70f3
equal deleted inserted replaced
1441:78ec3e2243e4 1442:244fb8bc3584
283 283
284 cxMapFree(map); 284 cxMapFree(map);
285 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); 285 CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
286 } 286 }
287 cx_testing_allocator_destroy(&talloc); 287 cx_testing_allocator_destroy(&talloc);
288 }
289
290 CX_TEST(test_hash_map_integer_keys) {
291 CxMap *map = cxHashMapCreateSimple(sizeof(cxstring));
292 CX_TEST_DO {
293 cxstring s1 = CX_STR("hello");
294 cxstring s2 = CX_STR("world");
295
296 cxMapPut(map, UINT32_C(70875), &s1);
297 cxMapPut(map, UINT64_C(5785133750), &s2);
298
299 CX_TEST_ASSERT(cx_strcmp_p(&s1, cxMapGet(map, UINT32_C(70875))) == 0);
300 CX_TEST_ASSERT(cx_strcmp_p(&s2, cxMapGet(map, UINT64_C(5785133750))) == 0);
301 }
302 cxMapFree(map);
288 } 303 }
289 304
290 CX_TEST(test_hash_map_remove_via_iterator) { 305 CX_TEST(test_hash_map_remove_via_iterator) {
291 CxTestingAllocator talloc; 306 CxTestingAllocator talloc;
292 cx_testing_allocator_init(&talloc); 307 cx_testing_allocator_init(&talloc);
914 cx_test_register(suite, test_hash_map_emplace_pointers); 929 cx_test_register(suite, test_hash_map_emplace_pointers);
915 cx_test_register(suite, test_hash_map_rehash); 930 cx_test_register(suite, test_hash_map_rehash);
916 cx_test_register(suite, test_hash_map_rehash_not_required); 931 cx_test_register(suite, test_hash_map_rehash_not_required);
917 cx_test_register(suite, test_hash_map_clear); 932 cx_test_register(suite, test_hash_map_clear);
918 cx_test_register(suite, test_hash_map_store_ucx_strings); 933 cx_test_register(suite, test_hash_map_store_ucx_strings);
934 cx_test_register(suite, test_hash_map_integer_keys);
919 cx_test_register(suite, test_hash_map_remove_via_iterator); 935 cx_test_register(suite, test_hash_map_remove_via_iterator);
920 cx_test_register(suite, test_hash_map_simple_destructor_objects); 936 cx_test_register(suite, test_hash_map_simple_destructor_objects);
921 cx_test_register(suite, test_hash_map_advanced_destructor_objects); 937 cx_test_register(suite, test_hash_map_advanced_destructor_objects);
922 cx_test_register(suite, test_hash_map_simple_destructor_pointers); 938 cx_test_register(suite, test_hash_map_simple_destructor_pointers);
923 cx_test_register(suite, test_hash_map_advanced_destructor_pointers); 939 cx_test_register(suite, test_hash_map_advanced_destructor_pointers);

mercurial