1163 CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true); \ |
1163 CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true); \ |
1164 tear_down_combo \ |
1164 tear_down_combo \ |
1165 } |
1165 } |
1166 #define roll_out_test_combos(name, body) \ |
1166 #define roll_out_test_combos(name, body) \ |
1167 static CX_TEST_SUBROUTINE(test_list_verify_##name, CxList *list, \ |
1167 static CX_TEST_SUBROUTINE(test_list_verify_##name, CxList *list, \ |
1168 __attribute__((__unused__)) bool isptrlist) body \ |
1168 cx_attr_unused bool isptrlist) body \ |
1169 roll_out_test_invokers(name) |
1169 roll_out_test_invokers(name) |
1170 |
1170 |
1171 static void set_default_class_funcs(CxList *list, cx_list_class *defaulted_cl) { |
1171 static void set_default_class_funcs(CxList *list, cx_list_class *defaulted_cl) { |
1172 const cx_list_class *cl = list->climpl == NULL ? list->cl : list->climpl; |
1172 const cx_list_class *cl = list->climpl == NULL ? list->cl : list->climpl; |
1173 memcpy(defaulted_cl, cl, sizeof(cx_list_class)); |
1173 memcpy(defaulted_cl, cl, sizeof(cx_list_class)); |
1186 #define do_set_default_class_funcs(list) \ |
1186 #define do_set_default_class_funcs(list) \ |
1187 cx_list_class defaulted_cl; \ |
1187 cx_list_class defaulted_cl; \ |
1188 set_default_class_funcs(list, &defaulted_cl) |
1188 set_default_class_funcs(list, &defaulted_cl) |
1189 #define roll_out_test_combos_with_defaulted_funcs(name, body) \ |
1189 #define roll_out_test_combos_with_defaulted_funcs(name, body) \ |
1190 static CX_TEST_SUBROUTINE(test_list_verify_##name, CxList *list, \ |
1190 static CX_TEST_SUBROUTINE(test_list_verify_##name, CxList *list, \ |
1191 __attribute__((__unused__)) bool isptrlist) body \ |
1191 cx_attr_unused bool isptrlist) body \ |
1192 roll_out_test_invokers(name) \ |
1192 roll_out_test_invokers(name) \ |
1193 CX_TEST(test_list_llm_##name) { \ |
1193 CX_TEST(test_list_llm_##name) { \ |
1194 set_up_combo \ |
1194 set_up_combo \ |
1195 CxList *list = cxLinkedListCreate(alloc, cx_cmp_int, sizeof(int)); \ |
1195 CxList *list = cxLinkedListCreate(alloc, cx_cmp_int, sizeof(int)); \ |
1196 do_set_default_class_funcs(list); \ |
1196 do_set_default_class_funcs(list); \ |
1385 CX_TEST_ASSERT(cxListRemove(list, testdata_len) != 0); |
1385 CX_TEST_ASSERT(cxListRemove(list, testdata_len) != 0); |
1386 free(testdata); |
1386 free(testdata); |
1387 }) |
1387 }) |
1388 |
1388 |
1389 static unsigned test_remove_array_destr_ctr; |
1389 static unsigned test_remove_array_destr_ctr; |
1390 static void test_remove_array_destr(__attribute__((__unused__)) void *d) { |
1390 static void test_remove_array_destr(cx_attr_unused void *d) { |
1391 test_remove_array_destr_ctr++; |
1391 test_remove_array_destr_ctr++; |
1392 } |
1392 } |
1393 |
1393 |
1394 roll_out_test_combos(remove_array, { |
1394 roll_out_test_combos(remove_array, { |
1395 const size_t testdata_len = 32; |
1395 const size_t testdata_len = 32; |
1765 destr_last_value = *ptr; |
1765 destr_last_value = *ptr; |
1766 *ptr = destr_last_value + 1; |
1766 *ptr = destr_last_value + 1; |
1767 destr_test_ctr++; |
1767 destr_test_ctr++; |
1768 } |
1768 } |
1769 |
1769 |
1770 static void advanced_destr_test_fun(__attribute__((__unused__)) void *u, void *data) { |
1770 static void advanced_destr_test_fun(cx_attr_unused void *u, void *data) { |
1771 simple_destr_test_fun(data); |
1771 simple_destr_test_fun(data); |
1772 } |
1772 } |
1773 |
1773 |
1774 static CX_TEST_SUBROUTINE(test_list_verify_destructor, CxList *list, |
1774 static CX_TEST_SUBROUTINE(test_list_verify_destructor, CxList *list, |
1775 const int *testdata, size_t testdata_len) { |
1775 const int *testdata, size_t testdata_len) { |