1368 CX_TEST_ASSERT(*(int *) cxListAt(list, 1) == 13); |
1368 CX_TEST_ASSERT(*(int *) cxListAt(list, 1) == 13); |
1369 CX_TEST_ASSERT(*(int *) cxListAt(list, 2) == 5); |
1369 CX_TEST_ASSERT(*(int *) cxListAt(list, 2) == 5); |
1370 CX_TEST_ASSERT(*(int *) cxListAt(list, 3) == 42); |
1370 CX_TEST_ASSERT(*(int *) cxListAt(list, 3) == 42); |
1371 }) |
1371 }) |
1372 |
1372 |
|
1373 roll_out_test_combos(emplace, { |
|
1374 if (isptrlist) { |
|
1375 int **x; |
|
1376 int y = 5; |
|
1377 int z = 7; |
|
1378 int w = 13; |
|
1379 |
|
1380 x = cxListEmplace(list); |
|
1381 CX_TEST_ASSERT(x != NULL); |
|
1382 CX_TEST_ASSERT(cxListSize(list) == 1); |
|
1383 *x = &y; |
|
1384 CX_TEST_ASSERT(*(int*)cxListAt(list, 0) == 5); |
|
1385 |
|
1386 x = cxListEmplace(list); |
|
1387 CX_TEST_ASSERT(x != NULL); |
|
1388 CX_TEST_ASSERT(cxListSize(list) == 2); |
|
1389 *x = &z; |
|
1390 CX_TEST_ASSERT(*(int*)cxListAt(list, 1) == 7); |
|
1391 |
|
1392 CX_TEST_ASSERT(NULL == cxListEmplaceAt(list, 3)); |
|
1393 CX_TEST_ASSERT(cxListSize(list) == 2); |
|
1394 |
|
1395 x = cxListEmplaceAt(list, 1); |
|
1396 CX_TEST_ASSERT(x != NULL); |
|
1397 CX_TEST_ASSERT(cxListSize(list) == 3); |
|
1398 *x = &w; |
|
1399 CX_TEST_ASSERT(*(int*)cxListAt(list, 0) == 5); |
|
1400 CX_TEST_ASSERT(*(int*)cxListAt(list, 1) == 13); |
|
1401 CX_TEST_ASSERT(*(int*)cxListAt(list, 2) == 7); |
|
1402 } else { |
|
1403 int *x; |
|
1404 |
|
1405 x = cxListEmplace(list); |
|
1406 CX_TEST_ASSERT(x != NULL); |
|
1407 CX_TEST_ASSERT(cxListSize(list) == 1); |
|
1408 *x = 5; |
|
1409 CX_TEST_ASSERT(*(int*)cxListAt(list, 0) == 5); |
|
1410 |
|
1411 x = cxListEmplace(list); |
|
1412 CX_TEST_ASSERT(x != NULL); |
|
1413 CX_TEST_ASSERT(cxListSize(list) == 2); |
|
1414 *x = 7; |
|
1415 CX_TEST_ASSERT(*(int*)cxListAt(list, 1) == 7); |
|
1416 |
|
1417 CX_TEST_ASSERT(NULL == cxListEmplaceAt(list, 3)); |
|
1418 CX_TEST_ASSERT(cxListSize(list) == 2); |
|
1419 |
|
1420 x = cxListEmplaceAt(list, 1); |
|
1421 CX_TEST_ASSERT(x != NULL); |
|
1422 CX_TEST_ASSERT(cxListSize(list) == 3); |
|
1423 *x = 13; |
|
1424 CX_TEST_ASSERT(*(int*)cxListAt(list, 0) == 5); |
|
1425 CX_TEST_ASSERT(*(int*)cxListAt(list, 1) == 13); |
|
1426 CX_TEST_ASSERT(*(int*)cxListAt(list, 2) == 7); |
|
1427 } |
|
1428 }) |
|
1429 |
1373 roll_out_test_combos_with_defaulted_funcs(insert_array, { |
1430 roll_out_test_combos_with_defaulted_funcs(insert_array, { |
1374 int a[5] = array_init(5, 47, 11, 13, 42); |
1431 int a[5] = array_init(5, 47, 11, 13, 42); |
1375 int b[5] = array_init(9, 18, 72, 50, 7); |
1432 int b[5] = array_init(9, 18, 72, 50, 7); |
1376 int *aptr[5]; |
1433 int *aptr[5]; |
1377 int *bptr[5]; |
1434 int *bptr[5]; |
1986 } |
2043 } |
1987 |
2044 |
1988 static CX_TEST_SUBROUTINE(test_list_verify_destructor, CxList *list, |
2045 static CX_TEST_SUBROUTINE(test_list_verify_destructor, CxList *list, |
1989 const int *testdata, size_t testdata_len) { |
2046 const int *testdata, size_t testdata_len) { |
1990 destr_test_ctr = 0; |
2047 destr_test_ctr = 0; |
1991 |
2048 |
1992 int off = list->collection.store_pointer ? 1 : 0; |
2049 int off = list->collection.store_pointer ? 1 : 0; |
1993 |
2050 |
1994 cxListRemove(list, 15); |
2051 cxListRemove(list, 15); |
1995 CX_TEST_ASSERT(1 == destr_test_ctr); |
2052 CX_TEST_ASSERT(1 == destr_test_ctr); |
1996 CX_TEST_ASSERT(testdata[15] == destr_last_value + off); |
2053 CX_TEST_ASSERT(testdata[15] == destr_last_value + off); |
2062 |
2119 |
2063 cx_test_register(suite, test_list_arl_add); |
2120 cx_test_register(suite, test_list_arl_add); |
2064 cx_test_register(suite, test_list_parl_add); |
2121 cx_test_register(suite, test_list_parl_add); |
2065 cx_test_register(suite, test_list_arl_insert); |
2122 cx_test_register(suite, test_list_arl_insert); |
2066 cx_test_register(suite, test_list_parl_insert); |
2123 cx_test_register(suite, test_list_parl_insert); |
|
2124 cx_test_register(suite, test_list_arl_emplace); |
|
2125 cx_test_register(suite, test_list_parl_emplace); |
2067 cx_test_register(suite, test_list_arl_insert_array); |
2126 cx_test_register(suite, test_list_arl_insert_array); |
2068 cx_test_register(suite, test_list_parl_insert_array); |
2127 cx_test_register(suite, test_list_parl_insert_array); |
2069 cx_test_register(suite, test_list_arl_insert_sorted); |
2128 cx_test_register(suite, test_list_arl_insert_sorted); |
2070 cx_test_register(suite, test_list_parl_insert_sorted); |
2129 cx_test_register(suite, test_list_parl_insert_sorted); |
2071 cx_test_register(suite, test_list_arl_remove); |
2130 cx_test_register(suite, test_list_arl_remove); |
2167 |
2226 |
2168 cx_test_register(suite, test_list_ll_add); |
2227 cx_test_register(suite, test_list_ll_add); |
2169 cx_test_register(suite, test_list_pll_add); |
2228 cx_test_register(suite, test_list_pll_add); |
2170 cx_test_register(suite, test_list_ll_insert); |
2229 cx_test_register(suite, test_list_ll_insert); |
2171 cx_test_register(suite, test_list_pll_insert); |
2230 cx_test_register(suite, test_list_pll_insert); |
|
2231 cx_test_register(suite, test_list_ll_emplace); |
|
2232 cx_test_register(suite, test_list_pll_emplace); |
2172 cx_test_register(suite, test_list_ll_insert_array); |
2233 cx_test_register(suite, test_list_ll_insert_array); |
2173 cx_test_register(suite, test_list_pll_insert_array); |
2234 cx_test_register(suite, test_list_pll_insert_array); |
2174 cx_test_register(suite, test_list_ll_insert_sorted); |
2235 cx_test_register(suite, test_list_ll_insert_sorted); |
2175 cx_test_register(suite, test_list_pll_insert_sorted); |
2236 cx_test_register(suite, test_list_pll_insert_sorted); |
2176 cx_test_register(suite, test_list_ll_remove); |
2237 cx_test_register(suite, test_list_ll_remove); |