tests/test_hash_map.c

changeset 1618
ef7cab6eb131
parent 1616
bdc04a8e0dd3
--- a/tests/test_hash_map.c	Tue Dec 16 21:33:58 2025 +0100
+++ b/tests/test_hash_map.c	Wed Dec 17 19:05:50 2025 +0100
@@ -48,7 +48,9 @@
         CX_TEST_ASSERT(map->collection.size == 0);
         CX_TEST_ASSERT(map->collection.allocator == allocator);
         CX_TEST_ASSERT(!map->collection.store_pointer);
-        CX_TEST_ASSERT(map->collection.cmpfunc == NULL);
+        CX_TEST_ASSERT(map->collection.simple_cmp == NULL);
+        CX_TEST_ASSERT(map->collection.advanced_cmp == cx_acmp_memcmp);
+        CX_TEST_ASSERT(map->collection.cmp_data == &map->collection.elem_size);
         CX_TEST_ASSERT(map->collection.simple_destructor == NULL);
         CX_TEST_ASSERT(map->collection.advanced_destructor == NULL);
         CX_TEST_ASSERT(map->collection.destructor_data == NULL);
@@ -74,6 +76,8 @@
         CX_TEST_ASSERT(map->collection.allocator == allocator);
         CX_TEST_ASSERT(map->collection.store_pointer);
         CX_TEST_ASSERT(map->collection.elem_size == sizeof(void *));
+        CX_TEST_ASSERT(map->collection.simple_cmp == cx_cmp_ptr);
+        CX_TEST_ASSERT(map->collection.advanced_cmp == NULL);
 
         cxMapFree(map);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
@@ -1272,9 +1276,8 @@
 CX_TEST(test_hash_map_compare) {
     CxMap *map1 = cxHashMapCreate(NULL, sizeof(int), 0);
     CxMap *map2 = cxHashMapCreate(NULL, CX_STORE_POINTERS, 0);
-    // TODO: fix specification of compare function once #622 is realized
-    map1->collection.cmpfunc = cx_cmp_int;
-    map2->collection.cmpfunc = cx_cmp_int;
+    cxSetCompareFunc(map1, cx_cmp_int);
+    cxSetCompareFunc(map2, cx_cmp_int);
 
     // some ints we can point to in the pointer map
     int z13 = 13;

mercurial