tests/test_hash_map.c

changeset 1442
244fb8bc3584
parent 1439
8e7fe85febc0
child 1443
6986e9ed70f3
--- a/tests/test_hash_map.c	Thu Oct 23 17:54:17 2025 +0200
+++ b/tests/test_hash_map.c	Fri Oct 24 20:52:10 2025 +0200
@@ -287,6 +287,21 @@
     cx_testing_allocator_destroy(&talloc);
 }
 
+CX_TEST(test_hash_map_integer_keys) {
+    CxMap *map = cxHashMapCreateSimple(sizeof(cxstring));
+    CX_TEST_DO {
+        cxstring s1 = CX_STR("hello");
+        cxstring s2 = CX_STR("world");
+
+        cxMapPut(map, UINT32_C(70875), &s1);
+        cxMapPut(map, UINT64_C(5785133750), &s2);
+
+        CX_TEST_ASSERT(cx_strcmp_p(&s1, cxMapGet(map, UINT32_C(70875))) == 0);
+        CX_TEST_ASSERT(cx_strcmp_p(&s2, cxMapGet(map, UINT64_C(5785133750))) == 0);
+    }
+    cxMapFree(map);
+}
+
 CX_TEST(test_hash_map_remove_via_iterator) {
     CxTestingAllocator talloc;
     cx_testing_allocator_init(&talloc);
@@ -916,6 +931,7 @@
     cx_test_register(suite, test_hash_map_rehash_not_required);
     cx_test_register(suite, test_hash_map_clear);
     cx_test_register(suite, test_hash_map_store_ucx_strings);
+    cx_test_register(suite, test_hash_map_integer_keys);
     cx_test_register(suite, test_hash_map_remove_via_iterator);
     cx_test_register(suite, test_hash_map_simple_destructor_objects);
     cx_test_register(suite, test_hash_map_advanced_destructor_objects);

mercurial