tests/test_list.c

changeset 993
b642eca4b956
parent 986
38fa7e41194c
--- a/tests/test_list.c	Tue Nov 26 22:00:03 2024 +0100
+++ b/tests/test_list.c	Tue Nov 26 22:16:27 2024 +0100
@@ -840,7 +840,7 @@
         CxList copy = *cxEmptyList;
         cxListSort(cxEmptyList);
         cxListClear(cxEmptyList);
-        cxListDestroy(cxEmptyList);
+        cxListFree(cxEmptyList);
         CX_TEST_ASSERT(0 == memcmp(&copy, cxEmptyList, sizeof(CxList))); // NOLINT(*-suspicious-memory-comparison)
     }
 }
@@ -880,8 +880,8 @@
         CX_TEST_ASSERT(0 > cxListCompare(cxEmptyList, ll));
         CX_TEST_ASSERT(0 > cxListCompare(cxEmptyList, al));
     }
-    cxListDestroy(ll);
-    cxListDestroy(al);
+    cxListFree(ll);
+    cxListFree(al);
 }
 
 CX_TEST(test_list_ll_create) {
@@ -899,7 +899,7 @@
         CX_TEST_ASSERT(list->collection.allocator == alloc);
         CX_TEST_ASSERT(list->collection.cmpfunc == cx_cmp_int);
         CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
     }
     cx_testing_allocator_destroy(&talloc);
@@ -918,7 +918,7 @@
         CX_TEST_ASSERT(list->collection.cmpfunc == NULL);
         CX_TEST_ASSERT(!cxListIsStoringPointers(list));
     }
-    cxListDestroy(list);
+    cxListFree(list);
 }
 
 CX_TEST(test_list_ll_store_pointers) {
@@ -935,7 +935,7 @@
         CX_TEST_ASSERT(list->climpl == NULL);
         CX_TEST_ASSERT(!cxListIsStoringPointers(list));
     }
-    cxListDestroy(list);
+    cxListFree(list);
 }
 
 CX_TEST(test_list_ll_create_simple_for_pointers) {
@@ -951,7 +951,7 @@
         CX_TEST_ASSERT(list->collection.cmpfunc == cx_cmp_ptr);
         CX_TEST_ASSERT(cxListIsStoringPointers(list));
     }
-    cxListDestroy(list);
+    cxListFree(list);
 }
 
 CX_TEST(test_list_arl_create) {
@@ -969,7 +969,7 @@
         CX_TEST_ASSERT(list->collection.allocator == alloc);
         CX_TEST_ASSERT(list->collection.cmpfunc == cx_cmp_int);
         CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
     }
     cx_testing_allocator_destroy(&talloc);
@@ -988,7 +988,7 @@
         CX_TEST_ASSERT(list->collection.cmpfunc == NULL);
         CX_TEST_ASSERT(!cxListIsStoringPointers(list));
     }
-    cxListDestroy(list);
+    cxListFree(list);
 }
 
 CX_TEST(test_list_arl_create_simple_for_pointers) {
@@ -1004,7 +1004,7 @@
         CX_TEST_ASSERT(list->collection.cmpfunc == cx_cmp_ptr);
         CX_TEST_ASSERT(cxListIsStoringPointers(list));
     }
-    cxListDestroy(list);
+    cxListFree(list);
 }
 
 static void test_fake_simple_int_destr(void *elem) {
@@ -1020,7 +1020,7 @@
         CxList *list = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS);
         cxListAdd(list, item);
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
-        cxListDestroy(list);
+        cxListFree(list);
         // item is not yet freed
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
         cxFree(alloc, item);
@@ -1035,7 +1035,7 @@
         CxList *list = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS);
         list->collection.simple_destructor = test_fake_simple_int_destr;
         cxListAdd(list, &item);
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(item == 42);
     }
 }
@@ -1051,7 +1051,7 @@
         list->collection.advanced_destructor = (cx_destructor_func2) cxFree;
         cxListAdd(list, item);
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
     }
     cx_testing_allocator_destroy(&talloc);
@@ -1066,7 +1066,7 @@
         CxList *list = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS, 4);
         cxListAdd(list, item);
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
-        cxListDestroy(list);
+        cxListFree(list);
         // item is not yet freed
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
         cxFree(alloc, item);
@@ -1081,7 +1081,7 @@
         CxList *list = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS, 4);
         list->collection.simple_destructor = test_fake_simple_int_destr;
         cxListAdd(list, &item);
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(item == 42);
     }
 }
@@ -1097,7 +1097,7 @@
         list->collection.advanced_destructor = (cx_destructor_func2) cxFree;
         cxListAdd(list, item);
         CX_TEST_ASSERT(!cx_testing_allocator_verify(&talloc));
-        cxListDestroy(list);
+        cxListFree(list);
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));
     }
     cx_testing_allocator_destroy(&talloc);
@@ -1109,7 +1109,7 @@
     CxAllocator *alloc = &talloc.base; \
     CX_TEST_DO {
 #define tear_down_combo \
-        cxListDestroy(list); \
+        cxListFree(list); \
         CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc));\
     } \
     cx_testing_allocator_destroy(&talloc);
@@ -1701,7 +1701,7 @@
     CxList *other = otherctr; \
     for (size_t i = 0; i < len; i++) cxListAdd(other, &testdata[i]); \
     CX_TEST_CALL_SUBROUTINE(test_list_verify_compare, list, other); \
-    cxListDestroy(other); \
+    cxListFree(other); \
     free(testdata); \
 })
 
@@ -1728,7 +1728,7 @@
     do_set_default_class_funcs(other);
     for (size_t i = 0; i < len; i++) cxListAdd(other, &testdata[i]);
     CX_TEST_CALL_SUBROUTINE(test_list_verify_compare, list, other);
-    cxListDestroy(other);
+    cxListFree(other);
     free(testdata);
 })
 

mercurial