test/test_list.c

changeset 488
9138acaa494b
parent 487
4bd19279778c
child 489
af6be1e123aa
     1.1 --- a/test/test_list.c	Tue Dec 28 14:25:05 2021 +0100
     1.2 +++ b/test/test_list.c	Tue Dec 28 17:24:18 2021 +0100
     1.3 @@ -570,6 +570,19 @@
     1.4      CU_ASSERT_TRUE(cxTestingAllocatorVerify())
     1.5  }
     1.6  
     1.7 +void test_hl_linked_list_from_array(void) {
     1.8 +    cxTestingAllocatorReset();
     1.9 +
    1.10 +    int data[] = {2, 4, 5, 7, 10, 15};
    1.11 +
    1.12 +    CxList expected = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
    1.13 +    for (int i = 0; i < 5; i++) cxListAdd(expected, &data[i]);
    1.14 +
    1.15 +    CxList list = cxLinkedListFromArray(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int), 5, data);
    1.16 +
    1.17 +    CU_ASSERT_TRUE(0 == cxListCompare(list, expected))
    1.18 +}
    1.19 +
    1.20  void test_hl_linked_list_add(void) {
    1.21      cxTestingAllocatorReset();
    1.22  
    1.23 @@ -994,6 +1007,7 @@
    1.24      suite = CU_add_suite("high level linked list", NULL, NULL);
    1.25  
    1.26      cu_add_test(suite, test_hl_linked_list_create);
    1.27 +    cu_add_test(suite, test_hl_linked_list_from_array);
    1.28      cu_add_test(suite, test_hl_linked_list_add);
    1.29      cu_add_test(suite, test_hl_linked_list_insert);
    1.30      cu_add_test(suite, test_hl_linked_list_remove);

mercurial