--- a/test/test_list.c Sat Jan 29 14:32:04 2022 +0100 +++ b/test/test_list.c Sun Jan 30 14:19:00 2022 +0100 @@ -560,7 +560,7 @@ void test_hl_linked_list_create(void) { cxTestingAllocatorReset(); - CxList list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); CU_ASSERT_EQUAL(list->size, 0) CU_ASSERT_EQUAL(list->capacity, (size_t) -1) @@ -575,7 +575,7 @@ void test_hl_ptr_linked_list_create(void) { cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); CU_ASSERT_EQUAL(list->size, 0) CU_ASSERT_EQUAL(list->capacity, (size_t) -1) @@ -592,10 +592,10 @@ int data[] = {2, 4, 5, 7, 10, 15}; - CxList expected = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *expected = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); for (int i = 0; i < 5; i++) cxListAdd(expected, &data[i]); - CxList list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 5, data); + CxList *list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 5, data); CU_ASSERT_TRUE(0 == cxListCompare(list, expected)) @@ -608,7 +608,7 @@ cxTestingAllocatorReset(); int data; - CxList list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); data = 5; CU_ASSERT_EQUAL(cxListAdd(list, &data), 0) @@ -621,7 +621,7 @@ CU_ASSERT_TRUE(list->capacity >= list->size) int exp[] = {5, 47, 13}; - CxList expected = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 3, exp); + CxList *expected = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 3, exp); CU_ASSERT_TRUE(0 == cxListCompare(list, expected)) cxLinkedListDestroy(list); @@ -632,7 +632,7 @@ void test_hl_ptr_linked_list_add(void) { cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); int a = 5, b = 47, c = 13; @@ -663,7 +663,7 @@ cxTestingAllocatorReset(); int data; - CxList list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); data = 5; CU_ASSERT_NOT_EQUAL(cxListInsert(list, 1, &data), 0) @@ -683,7 +683,7 @@ CU_ASSERT_TRUE(list->capacity >= list->size) int exp[] = {47, 13, 5, 42}; - CxList expected = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 4, exp); + CxList *expected = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 4, exp); CU_ASSERT_TRUE(0 == cxListCompare(list, expected)) cxLinkedListDestroy(list); @@ -694,7 +694,7 @@ void test_hl_ptr_linked_list_insert(void) { cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); int a = 5, b = 47, c = 13, d = 42; @@ -724,8 +724,8 @@ cxTestingAllocatorReset(); int data[] = {5, 47, 42, 13}; - CxList list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, - sizeof(int), 4, data); + CxList *list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, + sizeof(int), 4, data); CU_ASSERT_EQUAL(list->size, 4) CU_ASSERT_TRUE(list->capacity >= list->size) @@ -764,7 +764,7 @@ cxTestingAllocatorReset(); int a = 5, b = 47, c = 42, d = 13; - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); cxListAdd(list, &a); cxListAdd(list, &b); @@ -808,8 +808,8 @@ cxTestingAllocatorReset(); int data[] = {5, 47, 13}; - CxList list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, - sizeof(int), 3, data); + CxList *list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, + sizeof(int), 3, data); CU_ASSERT_EQUAL(*(int *) cxListAt(list, 0), 5) CU_ASSERT_EQUAL(*(int *) cxListAt(list, 1), 47) @@ -823,7 +823,7 @@ void test_hl_ptr_linked_list_at(void) { cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); int a = 5, b = 47, c = 13; cxListAdd(list, &a); @@ -843,8 +843,8 @@ cxTestingAllocatorReset(); int data[] = {5, 47, 13}; - CxList list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, - sizeof(int), 3, data); + CxList *list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, + sizeof(int), 3, data); CU_ASSERT_EQUAL(list->size, 3) CU_ASSERT_TRUE(list->capacity >= list->size) @@ -869,7 +869,7 @@ cxTestingAllocatorReset(); int a = 5, b = 47, c = 13, criteria; - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); cxListAdd(list, &a); cxListAdd(list, &b); @@ -915,8 +915,8 @@ cxTestingAllocatorReset(); - CxList list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 100, scrambled); - CxList exp = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 100, expected); + CxList *list = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 100, scrambled); + CxList *exp = cxLinkedListFromArray(cxTestingAllocator, cmp_int, sizeof(int), 100, expected); cxListSort(list); CU_ASSERT_TRUE(0 == cxListCompare(list, exp)) @@ -946,7 +946,7 @@ cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); for (int i = 0; i < 100; i++) { cxListAdd(list, &scrambled[i]); @@ -962,7 +962,7 @@ CU_ASSERT_TRUE(cxTestingAllocatorVerify()) } -void test_hl_linked_list_iterator_impl(CxList list) { +void test_hl_linked_list_iterator_impl(CxList *list) { int i = 0; CxIterator iter = cxListBegin(list); cx_foreach(int*, x, iter) { @@ -984,7 +984,7 @@ void test_hl_linked_list_iterator(void) { cxTestingAllocatorReset(); - CxList list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); for (int i = 0; i < 10; i++) { cxListAdd(list, &i); } @@ -993,7 +993,7 @@ void test_hl_ptr_linked_list_iterator(void) { cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); int data[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; for (int i = 0; i < 10; i++) { cxListAdd(list, &data[i]); @@ -1003,7 +1003,7 @@ void test_hl_linked_list_insert_via_iterator(void) { cxTestingAllocatorReset(); - CxList list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); + CxList *list = cxLinkedListCreate(cxTestingAllocator, cmp_int, sizeof(int)); for (int i = 0; i < 5; i++) { cxListAdd(list, &i); } @@ -1037,8 +1037,8 @@ CU_ASSERT_FALSE(cxIteratorValid(&iter)) int expdata[] = {30, 0, 1, 20, 2, 10, 3, 4, 40, 50}; - CxList expected = cxLinkedListFromArray(cxTestingAllocator, - cmp_int, sizeof(int), 10, expdata); + CxList *expected = cxLinkedListFromArray(cxTestingAllocator, + cmp_int, sizeof(int), 10, expdata); CU_ASSERT_EQUAL(0, cxListCompare(list, expected)) cxLinkedListDestroy(list); @@ -1049,7 +1049,7 @@ void test_hl_ptr_linked_list_insert_via_iterator(void) { int testdata[] = {0, 1, 2, 3, 4, 10, 20, 30, 40, 50}; cxTestingAllocatorReset(); - CxList list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); + CxList *list = cxPointerLinkedListCreate(cxTestingAllocator, cmp_int); int i; for (i = 0; i < 5; i++) { cxListAdd(list, &testdata[i]);