# HG changeset patch # User Mike Becker # Date 1762702162 -3600 # Node ID 1dda1eed1899d07a491e6088198a65ba6fa33c12 # Parent 83146195a1db253b05fdca70725cc5a75641bf01 improve insert_unique test case to cover previously uncovered cases diff -r 83146195a1db -r 1dda1eed1899 tests/test_list.c --- a/tests/test_list.c Sun Nov 09 16:12:07 2025 +0100 +++ b/tests/test_list.c Sun Nov 09 16:29:22 2025 +0100 @@ -1798,22 +1798,22 @@ int d3 = 60; int d4 = 40; int d5 = 70; - int d6a[6] = array_init(52, 54, 56, 62, 64, 75); - int d7a[6] = array_init(51, 57, 58, 65, 77, 78); + int d6a[8] = array_init(52, 54, 56, 56, 62, 62, 64, 75); + int d7a[8] = array_init(51, 51, 57, 58, 65, 77, 78, 78); int d8 = 90; int d9 = 56; - int d10a[3] = array_init(67, 75, 90); - int *d6ptr[6]; - int *d7ptr[6]; - int *d10ptr[3]; - for (size_t i = 0; i < 6; i++) { + int d10a[5] = array_init(58, 58, 67, 75, 90); + int *d6ptr[8]; + int *d7ptr[8]; + int *d10ptr[5]; + for (size_t i = 0; i < 8; i++) { d6ptr[i] = &d6a[i]; d7ptr[i] = &d7a[i]; } - for (size_t i = 0 ; i < 3 ; i++) { + for (size_t i = 0 ; i < 5 ; i++) { d10ptr[i] = &d10a[i]; } - size_t inserted; + size_t processed; int expected[19] = array_init( 40, 50, 51, 52, 54, 56, 57, 58, 60, 62, 64, 65, 67, 70, 75, 77, 78, 80, 90 @@ -1825,25 +1825,25 @@ CX_TEST_ASSERT(0 == cxListInsertUnique(list, &d4)); CX_TEST_ASSERT(0 == cxListInsertUnique(list, &d5)); if (isptrlist) { - inserted = cxListInsertUniqueArray(list, d6ptr, 6); + processed = cxListInsertUniqueArray(list, d6ptr, 8); } else { - inserted = cxListInsertUniqueArray(list, d6a, 6); + processed = cxListInsertUniqueArray(list, d6a, 8); } - CX_TEST_ASSERT(inserted == 6); + CX_TEST_ASSERT(processed == 8); if (isptrlist) { - inserted = cxListInsertUniqueArray(list, d7ptr, 6); + processed = cxListInsertUniqueArray(list, d7ptr, 8); } else { - inserted = cxListInsertUniqueArray(list, d7a, 6); + processed = cxListInsertUniqueArray(list, d7a, 8); } - CX_TEST_ASSERT(inserted == 6); + CX_TEST_ASSERT(processed == 8); CX_TEST_ASSERT(0 == cxListInsertUnique(list, &d8)); CX_TEST_ASSERT(0 == cxListInsertUnique(list, &d9)); if (isptrlist) { - inserted = cxListInsertUniqueArray(list, d10ptr, 3); + processed = cxListInsertUniqueArray(list, d10ptr, 5); } else { - inserted = cxListInsertUniqueArray(list, d10a, 3); + processed = cxListInsertUniqueArray(list, d10a, 5); } - CX_TEST_ASSERT(inserted == 3); + CX_TEST_ASSERT(processed == 5); CX_TEST_ASSERT(cxListSize(list) == 19); for (size_t i = 0; i < 19; i++) { CX_TEST_ASSERT(*(int *) cxListAt(list, i) == expected[i]);