diff -r 4bd19279778c -r 9138acaa494b test/test_list.c --- a/test/test_list.c Tue Dec 28 14:25:05 2021 +0100 +++ b/test/test_list.c Tue Dec 28 17:24:18 2021 +0100 @@ -570,6 +570,19 @@ CU_ASSERT_TRUE(cxTestingAllocatorVerify()) } +void test_hl_linked_list_from_array(void) { + cxTestingAllocatorReset(); + + int data[] = {2, 4, 5, 7, 10, 15}; + + CxList expected = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int)); + for (int i = 0; i < 5; i++) cxListAdd(expected, &data[i]); + + CxList list = cxLinkedListFromArray(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int), 5, data); + + CU_ASSERT_TRUE(0 == cxListCompare(list, expected)) +} + void test_hl_linked_list_add(void) { cxTestingAllocatorReset(); @@ -994,6 +1007,7 @@ suite = CU_add_suite("high level linked list", NULL, NULL); cu_add_test(suite, test_hl_linked_list_create); + cu_add_test(suite, test_hl_linked_list_from_array); cu_add_test(suite, test_hl_linked_list_add); cu_add_test(suite, test_hl_linked_list_insert); cu_add_test(suite, test_hl_linked_list_remove);