tests/test_properties.c

changeset 1557
03fbf1c99e73
parent 1555
8972247f54e8
child 1558
fc863c877a75
--- a/tests/test_properties.c	Sun Dec 07 19:36:51 2025 +0100
+++ b/tests/test_properties.c	Mon Dec 08 23:09:11 2025 +0100
@@ -384,6 +384,8 @@
 }
 
 CX_TEST(test_properties_load) {
+    CxTestingAllocator talloc;
+    cx_testing_allocator_init(&talloc);
     char fname[16] = "ucxtestXXXXXX";
     int tmpfd = mkstemp(fname);
     FILE *f = tmpfd < 0 ? NULL : fdopen(tmpfd, "w");
@@ -412,8 +414,8 @@
 
         // we want to load the properties into a map of char* pointers
         CxMap *map = cxHashMapCreateSimple(CX_STORE_POINTERS);
-        cxDefineDestructor(map, cxFreeDefault);
-        CxPropertiesStatus status = cxPropertiesLoadDefault(fname, map);
+        cxDefineAdvancedDestructor(map, cxFree, &talloc);
+        CxPropertiesStatus status = cxPropertiesLoadDefault(&talloc.base, fname, map);
 
         CX_TEST_ASSERT(status == CX_PROPERTIES_NO_ERROR);
         CX_TEST_ASSERT(cxMapSize(map) == 5);
@@ -440,8 +442,11 @@
 
         free(long_key);
         free(long_value);
+        CX_TEST_ASSERT(cx_testing_allocator_used(&talloc));
         cxMapFree(map);
+        CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
     }
+    cx_testing_allocator_destroy(&talloc);
     if (f) fclose(f);
     remove(fname);
 }

mercurial