tests/test_hash_map.c

changeset 1635
4983b6a34996
parent 1632
f74e4fc496a2
child 1638
14ae6a039af7
--- a/tests/test_hash_map.c	Fri Dec 19 17:37:17 2025 +0100
+++ b/tests/test_hash_map.c	Fri Dec 19 17:41:53 2025 +0100
@@ -38,19 +38,19 @@
     cx_testing_allocator_init(&talloc);
     CxAllocator *allocator = &talloc.base;
     CX_TEST_DO {
-        CxMap *map = cxHashMapCreate(allocator, 1, 0);
+        CxMap *map = cxHashMapCreate(allocator, sizeof(int), 0);
         struct cx_hash_map_s *hmap = (struct cx_hash_map_s *) map;
         CX_TEST_ASSERT(hmap->bucket_count > 0);
         for(size_t i = 0 ; i < hmap->bucket_count ; i++) {
             CX_TEST_ASSERT(hmap->buckets[i] == NULL);
         }
-        CX_TEST_ASSERT(map->collection.elem_size == 1);
+        CX_TEST_ASSERT(map->collection.elem_size == 4);
         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.simple_cmp == NULL);
-        CX_TEST_ASSERT(map->collection.advanced_cmp == cx_ccmp_memcmp);
-        CX_TEST_ASSERT(map->collection.cmp_data == &map->collection.elem_size);
+        CX_TEST_ASSERT(map->collection.advanced_cmp != NULL);
+        CX_TEST_ASSERT((uintptr_t) map->collection.cmp_data == sizeof(int));
         CX_TEST_ASSERT(map->collection.simple_destructor == NULL);
         CX_TEST_ASSERT(map->collection.advanced_destructor == NULL);
         CX_TEST_ASSERT(map->collection.destructor_data == NULL);

mercurial