fix some broken cleanup

Tue, 09 Jan 2024 00:09:11 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 09 Jan 2024 00:09:11 +0100
changeset 799
a2a757d225b4
parent 798
7644da6e2d35
child 800
1274e46b3013

fix some broken cleanup

tests/test_list.c file | annotate | diff | comparison | revisions
--- a/tests/test_list.c	Tue Jan 09 00:01:03 2024 +0100
+++ b/tests/test_list.c	Tue Jan 09 00:09:11 2024 +0100
@@ -492,8 +492,11 @@
 
 CX_TEST(test_linked_list_sort_empty) {
     void *begin = NULL;
-    // cannot assert something, we can just test that it does not crash
-    cx_linked_list_sort(&begin, NULL, loc_prev, loc_next, loc_data, cx_cmp_int);
+    CX_TEST_DO {
+        // cannot assert something, we can just test that it does not crash
+        cx_linked_list_sort(&begin, NULL, loc_prev, loc_next, loc_data, cx_cmp_int);
+        CX_TEST_ASSERT(true);
+    }
 }
 
 CX_TEST(test_linked_list_sort) {
@@ -528,7 +531,8 @@
         CX_TEST_ASSERT(check == NULL);
         CX_TEST_ASSERT(end == check_last);
     }
-    free(scrambled);
+    destroy_nodes_test_data(begin);
+    free(sorted);
     free(testdata);
 }
 
@@ -537,8 +541,8 @@
     void *expected = create_nodes_test_data(4);
     assign_nodes_test_data(testdata, 2, 4, 6, 8);
     assign_nodes_test_data(expected, 8, 6, 4, 2);
+    void *begin = testdata;
     CX_TEST_DO {
-        void *begin = testdata;
         void *end = cx_linked_list_last(begin, loc_next);
         void *orig_begin = begin, *orig_end = end;
 
@@ -547,7 +551,7 @@
         CX_TEST_ASSERT(begin == orig_end);
         CX_TEST_ASSERT(0 == cx_linked_list_compare(begin, expected, loc_next, loc_data, cx_cmp_int));
     }
-    destroy_nodes_test_data(testdata);
+    destroy_nodes_test_data(begin);
     destroy_nodes_test_data(expected);
 }
 

mercurial