Tue, 09 Jan 2024 00:09:11 +0100
fix some broken cleanup
tests/test_list.c | file | annotate | diff | comparison | revisions |
1.1 --- a/tests/test_list.c Tue Jan 09 00:01:03 2024 +0100 1.2 +++ b/tests/test_list.c Tue Jan 09 00:09:11 2024 +0100 1.3 @@ -492,8 +492,11 @@ 1.4 1.5 CX_TEST(test_linked_list_sort_empty) { 1.6 void *begin = NULL; 1.7 - // cannot assert something, we can just test that it does not crash 1.8 - cx_linked_list_sort(&begin, NULL, loc_prev, loc_next, loc_data, cx_cmp_int); 1.9 + CX_TEST_DO { 1.10 + // cannot assert something, we can just test that it does not crash 1.11 + cx_linked_list_sort(&begin, NULL, loc_prev, loc_next, loc_data, cx_cmp_int); 1.12 + CX_TEST_ASSERT(true); 1.13 + } 1.14 } 1.15 1.16 CX_TEST(test_linked_list_sort) { 1.17 @@ -528,7 +531,8 @@ 1.18 CX_TEST_ASSERT(check == NULL); 1.19 CX_TEST_ASSERT(end == check_last); 1.20 } 1.21 - free(scrambled); 1.22 + destroy_nodes_test_data(begin); 1.23 + free(sorted); 1.24 free(testdata); 1.25 } 1.26 1.27 @@ -537,8 +541,8 @@ 1.28 void *expected = create_nodes_test_data(4); 1.29 assign_nodes_test_data(testdata, 2, 4, 6, 8); 1.30 assign_nodes_test_data(expected, 8, 6, 4, 2); 1.31 + void *begin = testdata; 1.32 CX_TEST_DO { 1.33 - void *begin = testdata; 1.34 void *end = cx_linked_list_last(begin, loc_next); 1.35 void *orig_begin = begin, *orig_end = end; 1.36 1.37 @@ -547,7 +551,7 @@ 1.38 CX_TEST_ASSERT(begin == orig_end); 1.39 CX_TEST_ASSERT(0 == cx_linked_list_compare(begin, expected, loc_next, loc_data, cx_cmp_int)); 1.40 } 1.41 - destroy_nodes_test_data(testdata); 1.42 + destroy_nodes_test_data(begin); 1.43 destroy_nodes_test_data(expected); 1.44 } 1.45