tests/test_list.c

changeset 807
c8d692131b1e
parent 804
5136f2fc32ec
child 818
2be8fe3d5a2d
     1.1 --- a/tests/test_list.c	Sun Jan 14 13:50:17 2024 +0100
     1.2 +++ b/tests/test_list.c	Mon Jan 15 20:59:18 2024 +0100
     1.3 @@ -867,30 +867,29 @@
     1.4      cx_testing_allocator_destroy(&talloc);
     1.5  #define roll_out_test_combos(name, body) \
     1.6  static CX_TEST_SUBROUTINE(test_list_verify_##name, CxList *list, \
     1.7 -    __attribute__((__unused__)) bool isptrlist, \
     1.8 -    __attribute__((__unused__)) bool islinkedlist) body \
     1.9 +    __attribute__((__unused__)) bool isptrlist) body \
    1.10  CX_TEST(test_list_ll_##name) { \
    1.11      set_up_combo \
    1.12          CxList *list = cxLinkedListCreate(alloc, cx_cmp_int, sizeof(int)); \
    1.13 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, false, true); \
    1.14 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, false); \
    1.15      tear_down_combo \
    1.16  } \
    1.17  CX_TEST(test_list_arl_##name) { \
    1.18      set_up_combo \
    1.19          CxList *list = cxArrayListCreate(alloc, cx_cmp_int, sizeof(int), 8); \
    1.20 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, false, false); \
    1.21 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, false); \
    1.22      tear_down_combo \
    1.23  } \
    1.24  CX_TEST(test_list_pll_##name) { \
    1.25      set_up_combo \
    1.26          CxList *list = cxLinkedListCreate(alloc, cx_cmp_int, CX_STORE_POINTERS); \
    1.27 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true, true); \
    1.28 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true); \
    1.29      tear_down_combo \
    1.30  } \
    1.31  CX_TEST(test_list_parl_##name) { \
    1.32      set_up_combo \
    1.33          CxList *list = cxArrayListCreate(alloc, cx_cmp_int, CX_STORE_POINTERS, 8); \
    1.34 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true, false); \
    1.35 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_##name, list, true); \
    1.36      tear_down_combo \
    1.37  }
    1.38  #define array_init(...) {__VA_ARGS__}
    1.39 @@ -1080,17 +1079,18 @@
    1.40      }
    1.41  })
    1.42  
    1.43 -roll_out_test_combos(swap_no_sbo, {
    1.44 -    if (islinkedlist) {
    1.45 -        CX_DISABLE_LINKED_LIST_SWAP_SBO = true;
    1.46 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_swap, list, isptrlist, true);
    1.47 -        CX_DISABLE_LINKED_LIST_SWAP_SBO = false;
    1.48 -    } else {
    1.49 -        CX_DISABLE_ARRAY_LIST_SWAP_SBO = true;
    1.50 -        CX_TEST_CALL_SUBROUTINE(test_list_verify_swap, list, isptrlist, false);
    1.51 -        CX_DISABLE_ARRAY_LIST_SWAP_SBO = false;
    1.52 -    }
    1.53 -})
    1.54 +CX_TEST(test_list_ll_swap_no_sbo) {
    1.55 +    set_up_combo
    1.56 +        CxList *list = cxLinkedListCreate(alloc, cx_cmp_int, 2*cx_linked_list_swap_sbo_size);
    1.57 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_swap, list, false);
    1.58 +    tear_down_combo
    1.59 +}
    1.60 +CX_TEST(test_list_arl_swap_no_sbo) {
    1.61 +    set_up_combo
    1.62 +        CxList *list = cxArrayListCreate(alloc, cx_cmp_int, 2*cx_array_swap_sbo_size, 8);
    1.63 +        CX_TEST_CALL_SUBROUTINE(test_list_verify_swap, list, false);
    1.64 +    tear_down_combo
    1.65 +}
    1.66  
    1.67  roll_out_test_combos(find, {
    1.68      const size_t testdata_len = 500;
    1.69 @@ -1368,7 +1368,6 @@
    1.70      cx_test_register(suite, test_list_arl_swap);
    1.71      cx_test_register(suite, test_list_parl_swap);
    1.72      cx_test_register(suite, test_list_arl_swap_no_sbo);
    1.73 -    cx_test_register(suite, test_list_parl_swap_no_sbo);
    1.74      cx_test_register(suite, test_list_arl_find);
    1.75      cx_test_register(suite, test_list_parl_find);
    1.76      cx_test_register(suite, test_list_arl_sort);
    1.77 @@ -1440,7 +1439,6 @@
    1.78      cx_test_register(suite, test_list_ll_swap);
    1.79      cx_test_register(suite, test_list_pll_swap);
    1.80      cx_test_register(suite, test_list_ll_swap_no_sbo);
    1.81 -    cx_test_register(suite, test_list_pll_swap_no_sbo);
    1.82      cx_test_register(suite, test_list_ll_find);
    1.83      cx_test_register(suite, test_list_pll_find);
    1.84      cx_test_register(suite, test_list_ll_sort);

mercurial