test/test_list.c

changeset 435
0fe204d50f54
parent 422
afd87df80b13
child 438
cd3069757010
     1.1 --- a/test/test_list.c	Sun Sep 26 18:01:51 2021 +0200
     1.2 +++ b/test/test_list.c	Sun Sep 26 18:31:24 2021 +0200
     1.3 @@ -40,20 +40,22 @@
     1.4  
     1.5      CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
     1.6  
     1.7 -    CU_ASSERT_EQUAL(list->data.size, 0)
     1.8 -    CU_ASSERT_EQUAL(list->data.capacity, (size_t) -1)
     1.9 -    CU_ASSERT_PTR_EQUAL(list->data.allocator, cxTestingAllocator)
    1.10 -    CU_ASSERT_EQUAL(list->data.itemsize, sizeof(int))
    1.11 -    CU_ASSERT_PTR_EQUAL(list->data.cmpfunc, cmp_int)
    1.12 +    CU_ASSERT_EQUAL(list->size, 0)
    1.13 +    CU_ASSERT_EQUAL(list->capacity, (size_t) -1)
    1.14 +    CU_ASSERT_PTR_EQUAL(list->allocator, cxTestingAllocator)
    1.15 +    CU_ASSERT_EQUAL(list->itemsize, sizeof(int))
    1.16 +    CU_ASSERT_PTR_EQUAL(list->cmpfunc, cmp_int)
    1.17  
    1.18 -    struct node {
    1.19 +    // assume this structure for a linked list
    1.20 +    struct ll_check {
    1.21 +        cx_list_s base;
    1.22          void *begin;
    1.23          void *end;
    1.24          ptrdiff_t ploc;
    1.25          ptrdiff_t nloc;
    1.26      };
    1.27  
    1.28 -    struct node *actual = (struct node *) list->data.listdata;
    1.29 +    struct ll_check *actual = (struct ll_check *) list;
    1.30      CU_ASSERT_PTR_NULL(actual->begin)
    1.31      CU_ASSERT_PTR_NULL(actual->end)
    1.32      CU_ASSERT_EQUAL(0, actual->ploc)

mercurial