test/test_list.c

changeset 460
e075009b33b7
parent 459
c0e2e9f83399
child 466
28bc3e10ac28
--- a/test/test_list.c	Sun Oct 03 18:51:44 2021 +0200
+++ b/test/test_list.c	Tue Oct 05 11:19:32 2021 +0200
@@ -181,18 +181,18 @@
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
     data = 5;
-    CU_ASSERT_EQUAL(cxTypedListAdd(int, list, &data), 0)
+    CU_ASSERT_EQUAL(cxListAdd(list, &data), 0)
     data = 47;
-    CU_ASSERT_EQUAL(cxTypedListAdd(int, list, &data), 0)
+    CU_ASSERT_EQUAL(cxListAdd(list, &data), 0)
     data = 13;
-    CU_ASSERT_EQUAL(cxTypedListAdd(int, list, &data), 0)
+    CU_ASSERT_EQUAL(cxListAdd(list, &data), 0)
 
     CU_ASSERT_EQUAL(list->size, 3)
     CU_ASSERT_TRUE(list->capacity >= list->size)
 
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 0), 5)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 1), 47)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 2), 13)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 0), 5)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 1), 47)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 2), 13)
 
     cxLinkedListDestroy(list);
     CU_ASSERT_TRUE(cxTestingAllocatorVerify())
@@ -204,15 +204,15 @@
     int data;
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
-    CU_ASSERT_PTR_NULL(cxTypedListLast(int, list))
+    CU_ASSERT_PTR_NULL(cxListLast(list))
 
     data = 5;
-    CU_ASSERT_EQUAL(cxTypedListAdd(int, list, &data), 0)
-    CU_ASSERT_EQUAL(*cxTypedListLast(int, list), 5)
+    CU_ASSERT_EQUAL(cxListAdd(list, &data), 0)
+    CU_ASSERT_EQUAL(*(int*)cxListLast(list), 5)
 
     data = 47;
-    CU_ASSERT_EQUAL(cxTypedListAdd(int, list, &data), 0)
-    CU_ASSERT_EQUAL(*cxTypedListLast(int, list), 47)
+    CU_ASSERT_EQUAL(cxListAdd(list, &data), 0)
+    CU_ASSERT_EQUAL(*(int*)cxListLast(list), 47)
 
     cxLinkedListDestroy(list);
     CU_ASSERT_TRUE(cxTestingAllocatorVerify())
@@ -225,26 +225,26 @@
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
     data = 5;
-    CU_ASSERT_NOT_EQUAL(cxTypedListInsert(int, list, 1, &data), 0)
+    CU_ASSERT_NOT_EQUAL(cxListInsert(list, 1, &data), 0)
     CU_ASSERT_EQUAL(list->size, 0)
-    CU_ASSERT_EQUAL(cxTypedListInsert(int, list, 0, &data), 0)
+    CU_ASSERT_EQUAL(cxListInsert(list, 0, &data), 0)
     CU_ASSERT_EQUAL(list->size, 1)
     data = 47;
-    CU_ASSERT_EQUAL(cxTypedListInsert(int, list, 0, &data), 0)
+    CU_ASSERT_EQUAL(cxListInsert(list, 0, &data), 0)
     CU_ASSERT_EQUAL(list->size, 2)
     data = 13;
-    CU_ASSERT_EQUAL(cxTypedListInsert(int, list, 1, &data), 0)
+    CU_ASSERT_EQUAL(cxListInsert(list, 1, &data), 0)
     CU_ASSERT_EQUAL(list->size, 3)
     data = 42;
-    CU_ASSERT_EQUAL(cxTypedListInsert(int, list, 3, &data), 0)
+    CU_ASSERT_EQUAL(cxListInsert(list, 3, &data), 0)
 
     CU_ASSERT_EQUAL(list->size, 4)
     CU_ASSERT_TRUE(list->capacity >= list->size)
 
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 0), 47)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 1), 13)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 2), 5)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 3), 42)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 0), 47)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 1), 13)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 2), 5)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 3), 42)
 
     cxLinkedListDestroy(list);
     CU_ASSERT_TRUE(cxTestingAllocatorVerify())
@@ -257,13 +257,13 @@
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
     data = 5;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
     data = 47;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
     data = 42;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
     data = 13;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
 
     CU_ASSERT_EQUAL(list->size, 4)
     CU_ASSERT_TRUE(list->capacity >= list->size)
@@ -273,20 +273,20 @@
     CU_ASSERT_EQUAL(cxListRemove(list, 2), 0)
     CU_ASSERT_EQUAL(list->size, 3)
     CU_ASSERT_TRUE(list->capacity >= list->size)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 0), 5)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 1), 47)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 2), 13)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 0), 5)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 1), 47)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 2), 13)
 
     CU_ASSERT_EQUAL(cxListRemove(list, 0), 0)
     CU_ASSERT_EQUAL(list->size, 2)
     CU_ASSERT_TRUE(list->capacity >= list->size)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 0), 47)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 1), 13)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 0), 47)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 1), 13)
 
     CU_ASSERT_EQUAL(cxListRemove(list, 1), 0)
     CU_ASSERT_EQUAL(list->size, 1)
     CU_ASSERT_TRUE(list->capacity >= list->size)
-    CU_ASSERT_EQUAL(*cxTypedListAt(int, list, 0), 47)
+    CU_ASSERT_EQUAL(*(int*)cxListAt(list, 0), 47)
 
     CU_ASSERT_EQUAL(cxListRemove(list, 0), 0)
     CU_ASSERT_EQUAL(list->size, 0)
@@ -305,25 +305,25 @@
     CxList list = cxLinkedListCreate(cxTestingAllocator, (CxListComparator) cmp_int, sizeof(int));
 
     data = 5;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
     data = 47;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
     data = 13;
-    cxTypedListAdd(int, list, &data);
+    cxListAdd(list, &data);
 
     CU_ASSERT_EQUAL(list->size, 3)
     CU_ASSERT_TRUE(list->capacity >= list->size)
 
     criteria = 5;
-    CU_ASSERT_EQUAL(cxTypedListFind(int, list, &criteria), 0)
+    CU_ASSERT_EQUAL(cxListFind(list, &criteria), 0)
     criteria = 47;
-    CU_ASSERT_EQUAL(cxTypedListFind(int, list, &criteria), 1)
+    CU_ASSERT_EQUAL(cxListFind(list, &criteria), 1)
     criteria = 13;
-    CU_ASSERT_EQUAL(cxTypedListFind(int, list, &criteria), 2)
+    CU_ASSERT_EQUAL(cxListFind(list, &criteria), 2)
     criteria = 9000;
-    CU_ASSERT_EQUAL(cxTypedListFind(int, list, &criteria), 3)
+    CU_ASSERT_EQUAL(cxListFind(list, &criteria), 3)
     criteria = -5;
-    CU_ASSERT_EQUAL(cxTypedListFind(int, list, &criteria), 3)
+    CU_ASSERT_EQUAL(cxListFind(list, &criteria), 3)
 
     cxLinkedListDestroy(list);
     CU_ASSERT_TRUE(cxTestingAllocatorVerify())

mercurial