test/test_list.c

changeset 435
0fe204d50f54
parent 422
afd87df80b13
child 438
cd3069757010
--- a/test/test_list.c	Sun Sep 26 18:01:51 2021 +0200
+++ b/test/test_list.c	Sun Sep 26 18:31:24 2021 +0200
@@ -40,20 +40,22 @@
 
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
-    CU_ASSERT_EQUAL(list->data.size, 0)
-    CU_ASSERT_EQUAL(list->data.capacity, (size_t) -1)
-    CU_ASSERT_PTR_EQUAL(list->data.allocator, cxTestingAllocator)
-    CU_ASSERT_EQUAL(list->data.itemsize, sizeof(int))
-    CU_ASSERT_PTR_EQUAL(list->data.cmpfunc, cmp_int)
+    CU_ASSERT_EQUAL(list->size, 0)
+    CU_ASSERT_EQUAL(list->capacity, (size_t) -1)
+    CU_ASSERT_PTR_EQUAL(list->allocator, cxTestingAllocator)
+    CU_ASSERT_EQUAL(list->itemsize, sizeof(int))
+    CU_ASSERT_PTR_EQUAL(list->cmpfunc, cmp_int)
 
-    struct node {
+    // assume this structure for a linked list
+    struct ll_check {
+        cx_list_s base;
         void *begin;
         void *end;
         ptrdiff_t ploc;
         ptrdiff_t nloc;
     };
 
-    struct node *actual = (struct node *) list->data.listdata;
+    struct ll_check *actual = (struct ll_check *) list;
     CU_ASSERT_PTR_NULL(actual->begin)
     CU_ASSERT_PTR_NULL(actual->end)
     CU_ASSERT_EQUAL(0, actual->ploc)

mercurial