--- a/tests/test_list.c Sat Nov 01 19:48:50 2025 +0100 +++ b/tests/test_list.c Sun Nov 02 18:04:35 2025 +0100 @@ -2695,11 +2695,7 @@ CxList *minuend = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, sizeof(int)); CxList *subtrahend = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, sizeof(int)); - int dst_data[] = { - 47, 178, 176, 83, 109, 149, 192, 38, 101, 116, 121, 73, 94, 197, 91, 79, 158, 86, 190, 138, 100, 39, 30, 144, - 35, 182, 155, 84, 139, 186, 67, 123, 62, 37, 3, 64, 172, 56, 160, 1, 156, 132, 131, 49, 10, 126, 171, 145, 77, - 107 - }; + int dst_data[] = {47, 178, 176, 83}; int minuend_data[] = { 153, 106, 171, 130, 74, 173, 150, 94, 27, 92, 70, 175, 200, 20, 29, 161, 88, 116, 71, 53, 199, 124, 32, 9, 76, 151, 33, 51, 37, 65, 176, 49, 12, 162, 28, 85, 4, 177, 198, 54, 109, 188, 44, 77, 194, 63, 41, 129, 97, 83 @@ -2709,11 +2705,10 @@ 120, 78, 100, 101, 42, 21, 1, 161, 10, 114, 198, 181, 178, 136, 188, 59, 41, 73, 99, 151, 144, 118, 53, 199, 71 }; - { - CxList *tmp = cxArrayListCreateSimple(sizeof(int), 50); - cxListAddArray(tmp, dst_data, 50); - cxListClone(dst, tmp, test_clone_func, &talloc.base, NULL); - cxListFree(tmp); + for (unsigned i = 0 ; i < cx_nmemb(dst_data) ; i++) { + int *x = cxMalloc(&talloc.base, sizeof(int)); + *x = dst_data[i]; + cxListAdd(dst, x); } cxListAddArray(minuend, minuend_data, 50); cxListAddArray(subtrahend, subtrahend_data, 50); @@ -2723,17 +2718,15 @@ cxListSort(subtrahend); } - // expected 36 elements stay in dst, and 36 will be added from the difference - size_t expected_len = 72; + // expected 36 elements in the difference + size_t expected_len = 40; int expected_unsorted[] = { - 47, 83, 109, 149, 192, 116, 121, 94, 91, 158, 86, 190, 138, 39, 30, 35, 182, 155, 84, 186, 67, 123, 62, 37, - 3, 172, 56, 160, 156, 132, 131, 126, 171, 145, 77, 107, + 47, 178, 176, 83, 153, 106, 171, 74, 173, 150, 94, 92, 70, 175, 200, 20, 29, 88, 116, 124, 32, 9, 76, 33, 51, 37, 65, 12, 162, 28, 4, 177, 54, 109, 44, 77, 194, 129, 97, 83 }; int expected_sorted[] = { - 3, 30, 35, 37, 39, 47, 56, 62, 67, 77, 83, 84, 86, 91, 94, 107, 109, 116, 121, 123, 126, 131, 132, 138, 145, - 149, 155, 156, 158, 160, 171, 172, 182, 186, 190, 192, + 47, 83, 176, 178, 4, 9, 12, 20, 28, 29, 32, 33, 37, 44, 51, 54, 65, 70, 74, 76, 77, 83, 88, 92, 94, 97, 106, 109, 116, 124, 129, 150, 153, 162, 171, 173, 175, 177, 194, 200 }; @@ -2741,7 +2734,7 @@ if (alloc_fail) { test_clone_func_max_enabled = true; test_clone_func_max_clones = 30; - expected_len = 66; + expected_len = 34; } CxList *expected = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, sizeof(int), expected_len); cxListAddArray(expected, sorted ? expected_sorted : expected_unsorted, expected_len);