temporarily remove pointer lists - see #234

Mon, 23 Jan 2023 20:34:18 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 23 Jan 2023 20:34:18 +0100
changeset 639
309e8b08c60e
parent 638
eafb45eefc51
child 640
55cc3b373c5e

temporarily remove pointer lists - see #234

src/cx/linked_list.h file | annotate | diff | comparison | revisions
src/linked_list.c file | annotate | diff | comparison | revisions
test/test_list.cpp file | annotate | diff | comparison | revisions
--- a/src/cx/linked_list.h	Mon Jan 23 20:22:11 2023 +0100
+++ b/src/cx/linked_list.h	Mon Jan 23 20:34:18 2023 +0100
@@ -63,23 +63,6 @@
 ) __attribute__((__nonnull__));
 
 /**
- * Allocates a linked list for storing pointers.
- *
- * If you want to store the elements directly in this list, use cxLinkedListCreate().
- *
- * @remark Since only pointers are stored in this list, a possible destructor
- * MAY free the memory pointed to by its argument in order to prevent memory leaks.
- *
- * @param allocator the allocator for allocating the list nodes
- * @param comparator the comparator for the elements
- * @return the created list
- */
-CxList *cxPointerLinkedListCreate(
-        CxAllocator const *allocator,
-        CxListComparator comparator
-) __attribute__((__nonnull__));
-
-/**
  * Finds the node at a certain index.
  *
  * This function can be used to start at an arbitrary position within the list.
@@ -109,8 +92,6 @@
  * @param start a pointer to the start node
  * @param loc_advance the location of the pointer to advance
  * @param loc_data the location of the \c data pointer within your node struct
- * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func.
- * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func.
  * @param cmp_func a compare function to compare \p elem against the node data
  * @param elem a pointer to the element to find
  * @return the index of the element or a past-one index if the element could not be found
@@ -119,7 +100,6 @@
         void const *start,
         ptrdiff_t loc_advance,
         ptrdiff_t loc_data,
-        bool follow_ptr,
         CxListComparator cmp_func,
         void const *elem
 ) __attribute__((__nonnull__));
@@ -339,20 +319,13 @@
 /**
  * Sorts a linked list based on a comparison function.
  *
- * This function can work with linked lists of the following structures:
+ * This function can work with linked lists of the following structure:
  * \code
  * typedef struct node node;
  * struct node {
  *   node* prev;
  *   node* next;
- *   my_payload data; // in this case set follow_ptr = 0
- * }
- *
- * typedef struct ptr_node ptr_node;
- * struct ptr_node {
- *   ptr_node* prev;
- *   ptr_node* next;
- *   my_payload* data; // in this case set follow_ptr = 1
+ *   my_payload data;
  * }
  * \endcode
  *
@@ -363,8 +336,6 @@
  * @param loc_prev the location of a \c prev pointer within your node struct (negative if not present)
  * @param loc_next the location of a \c next pointer within your node struct (required)
  * @param loc_data the location of the \c data pointer within your node struct
- * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func.
- * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func.
  * @param cmp_func the compare function defining the sort order
  */
 void cx_linked_list_sort(
@@ -373,26 +344,19 @@
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next,
         ptrdiff_t loc_data,
-        bool follow_ptr,
         CxListComparator cmp_func
-) __attribute__((__nonnull__(1, 7)));
+) __attribute__((__nonnull__(1, 6)));
 
 
 /**
  * Compares two lists element wise.
  *
- * The \c follow_ptr flags have the following meaning: if \c false, the pointer denoted by \p loc_data shall
- * directly be passed to the \p cmp_func.
- * If \c true, the data at \p loc_data is assumed to be a pointer, dereferenced, and then passed to \p cmp_func.
- *
  * \note Both list must have the same structure.
  *
  * @param begin_left the begin of the left list (\c NULL denotes an empty list)
  * @param begin_right the begin of the right list  (\c NULL denotes an empty list)
  * @param loc_advance the location of the pointer to advance
  * @param loc_data the location of the \c data pointer within your node struct
- * @param follow_ptr_left indicates whether pointers in the left list shall be dereferenced
- * @param follow_ptr_right indicates whether pointers in the right list shall be dereferenced
  * @param cmp_func the function to compare the elements
  * @return the first non-zero result of invoking \p cmp_func or: negative if the left list is smaller than the
  * right list, positive if the left list is larger than the right list, zero if both lists are equal.
@@ -402,10 +366,8 @@
         void const *begin_right,
         ptrdiff_t loc_advance,
         ptrdiff_t loc_data,
-        bool follow_ptr_left,
-        bool follow_ptr_right,
         CxListComparator cmp_func
-) __attribute__((__nonnull__(7)));
+) __attribute__((__nonnull__(5)));
 
 /**
  * Reverses the order of the nodes in a linked list.
--- a/src/linked_list.c	Mon Jan 23 20:22:11 2023 +0100
+++ b/src/linked_list.c	Mon Jan 23 20:34:18 2023 +0100
@@ -38,8 +38,7 @@
 #define ll_prev(node) CX_LL_PTR(node, loc_prev)
 #define ll_next(node) CX_LL_PTR(node, loc_next)
 #define ll_advance(node) CX_LL_PTR(node, loc_advance)
-#define ll_data_f(node, follow_ptr) ((follow_ptr)?CX_LL_PTR(node, loc_data):(((char*)(node))+loc_data))
-#define ll_data(node) ll_data_f(node,follow_ptr)
+#define ll_data(node) (((char*)(node))+loc_data)
 
 void *cx_linked_list_at(
         void const *start,
@@ -62,7 +61,6 @@
         void const *start,
         ptrdiff_t loc_advance,
         ptrdiff_t loc_data,
-        bool follow_ptr,
         CxListComparator cmp_func,
         void const *elem
 ) {
@@ -286,7 +284,6 @@
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next,
         ptrdiff_t loc_data,
-        bool follow_ptr,
         size_t length,
         void *ls,
         void *le,
@@ -343,7 +340,6 @@
         ptrdiff_t loc_prev,
         ptrdiff_t loc_next,
         ptrdiff_t loc_data,
-        bool follow_ptr,
         CxListComparator cmp_func
 ) {
     assert(begin != NULL);
@@ -378,17 +374,17 @@
         re = ll_next(rc);
 
         // {ls,...,le->prev} and {rs,...,re->prev} are sorted - merge them
-        void *sorted = cx_linked_list_sort_merge(loc_prev, loc_next, loc_data, follow_ptr,
+        void *sorted = cx_linked_list_sort_merge(loc_prev, loc_next, loc_data,
                                                  ln + rn, ls, le, re, cmp_func);
 
         // Something left? Sort it!
         size_t remainder_length = cx_linked_list_size(re, loc_next);
         if (remainder_length > 0) {
             void *remainder = re;
-            cx_linked_list_sort(&remainder, NULL, loc_prev, loc_next, loc_data, follow_ptr, cmp_func);
+            cx_linked_list_sort(&remainder, NULL, loc_prev, loc_next, loc_data, cmp_func);
 
             // merge sorted list with (also sorted) remainder
-            *begin = cx_linked_list_sort_merge(loc_prev, loc_next, loc_data, follow_ptr,
+            *begin = cx_linked_list_sort_merge(loc_prev, loc_next, loc_data,
                                                ln + rn + remainder_length,
                                                sorted, remainder, NULL, cmp_func);
         } else {
@@ -404,15 +400,13 @@
         void const *begin_right,
         ptrdiff_t loc_advance,
         ptrdiff_t loc_data,
-        bool follow_ptr_left,
-        bool follow_ptr_right,
         CxListComparator cmp_func
 ) {
     void const *left = begin_left, *right = begin_right;
 
     while (left != NULL && right != NULL) {
-        void const *left_data = ll_data_f(left, follow_ptr_left);
-        void const *right_data = ll_data_f(right, follow_ptr_right);
+        void const *left_data = ll_data(left);
+        void const *right_data = ll_data(right);
         int result = cmp_func(left_data, right_data);
         if (result != 0) return result;
         left = ll_advance(left);
@@ -472,7 +466,6 @@
     struct cx_list_s base;
     cx_linked_list_node *begin;
     cx_linked_list_node *end;
-    bool follow_ptr;
 } cx_linked_list;
 
 static cx_linked_list_node *cx_ll_node_at(
@@ -576,21 +569,6 @@
     return cx_ll_insert_array(list, list->size, array, n);
 }
 
-static int cx_pll_insert(
-        struct cx_list_s *list,
-        size_t index,
-        void const *elem
-) {
-    return cx_ll_insert(list, index, &elem);
-}
-
-static int cx_pll_add(
-        struct cx_list_s *list,
-        void const *elem
-) {
-    return cx_ll_insert(list, list->size, &elem);
-}
-
 static int cx_ll_remove(
         struct cx_list_s *list,
         size_t index
@@ -623,30 +601,20 @@
     return node == NULL ? NULL : node->payload;
 }
 
-static void *cx_pll_at(
-        struct cx_list_s const *list,
-        size_t index
-) {
-    cx_linked_list *ll = (cx_linked_list *) list;
-    cx_linked_list_node *node = cx_ll_node_at(ll, index);
-    return node == NULL ? NULL : *(void **) node->payload;
-}
-
 static size_t cx_ll_find(
         struct cx_list_s const *list,
         void const *elem
 ) {
-    cx_linked_list *ll = (cx_linked_list *) list;
     return cx_linked_list_find(((cx_linked_list *) list)->begin,
                                CX_LL_LOC_NEXT, CX_LL_LOC_DATA,
-                               ll->follow_ptr, list->cmpfunc, elem);
+                               list->cmpfunc, elem);
 }
 
 static void cx_ll_sort(struct cx_list_s *list) {
     cx_linked_list *ll = (cx_linked_list *) list;
     cx_linked_list_sort((void **) &ll->begin, (void **) &ll->end,
                         CX_LL_LOC_PREV, CX_LL_LOC_NEXT, CX_LL_LOC_DATA,
-                        ll->follow_ptr, list->cmpfunc);
+                        list->cmpfunc);
 }
 
 static void cx_ll_reverse(struct cx_list_s *list) {
@@ -662,7 +630,7 @@
     cx_linked_list *right = (cx_linked_list *) other;
     return cx_linked_list_compare(left->begin, right->begin,
                                   CX_LL_LOC_NEXT, CX_LL_LOC_DATA,
-                                  left->follow_ptr, right->follow_ptr, list->cmpfunc);
+                                  list->cmpfunc);
 }
 
 static bool cx_ll_iter_valid(void const *it) {
@@ -696,12 +664,6 @@
     return node->payload;
 }
 
-static void *cx_pll_iter_current(void const *it) {
-    struct cx_iterator_s const *iter = it;
-    cx_linked_list_node *node = iter->elem_handle;
-    return *(void **) node->payload;
-}
-
 static bool cx_ll_iter_flag_rm(void *it) {
     struct cx_iterator_base_s *iter = it;
     if (iter->mutating) {
@@ -729,15 +691,6 @@
     return iter;
 }
 
-static CxIterator cx_pll_iterator(
-        struct cx_list_s const *list,
-        size_t index
-) {
-    CxIterator iter = cx_ll_iterator(list, index);
-    iter.base.current = cx_pll_iter_current;
-    return iter;
-}
-
 static CxMutIterator cx_ll_mut_iterator(
         struct cx_list_s *list,
         size_t index
@@ -751,15 +704,6 @@
     return iter;
 }
 
-static CxMutIterator cx_pll_mut_iterator(
-        struct cx_list_s *list,
-        size_t index
-) {
-    CxMutIterator iter = cx_ll_mut_iterator(list, index);
-    iter.base.current = cx_pll_iter_current;
-    return iter;
-}
-
 static int cx_ll_insert_iter(
         CxMutIterator *iter,
         void const *elem,
@@ -780,14 +724,6 @@
     }
 }
 
-static int cx_pll_insert_iter(
-        CxMutIterator *iter,
-        void const *elem,
-        int prepend
-) {
-    return cx_ll_insert_iter(iter, &elem, prepend);
-}
-
 static void cx_ll_destructor(CxList *list) {
     cx_linked_list *ll = (cx_linked_list *) list;
 
@@ -817,23 +753,6 @@
         cx_ll_mut_iterator,
 };
 
-static cx_list_class cx_pointer_linked_list_class = {
-        cx_ll_destructor,
-        cx_pll_add,
-        cx_ll_add_array,
-        cx_pll_insert,
-        cx_ll_insert_array,
-        cx_pll_insert_iter,
-        cx_ll_remove,
-        cx_pll_at,
-        cx_ll_find,
-        cx_ll_sort,
-        cx_ll_compare,
-        cx_ll_reverse,
-        cx_pll_iterator,
-        cx_pll_mut_iterator,
-};
-
 CxList *cxLinkedListCreate(
         CxAllocator const *allocator,
         CxListComparator comparator,
@@ -842,7 +761,6 @@
     cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
     if (list == NULL) return NULL;
 
-    list->follow_ptr = false;
     list->base.cl = &cx_linked_list_class;
     list->base.allocator = allocator;
     list->base.cmpfunc = comparator;
@@ -851,20 +769,3 @@
 
     return (CxList *) list;
 }
-
-CxList *cxPointerLinkedListCreate(
-        CxAllocator const *allocator,
-        CxListComparator comparator
-) {
-    cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
-    if (list == NULL) return NULL;
-
-    list->follow_ptr = true;
-    list->base.cl = &cx_pointer_linked_list_class;
-    list->base.allocator = allocator;
-    list->base.cmpfunc = comparator;
-    list->base.itemsize = sizeof(void *);
-    list->base.capacity = SIZE_MAX;
-
-    return (CxList *) list;
-}
--- a/test/test_list.cpp	Mon Jan 23 20:22:11 2023 +0100
+++ b/test/test_list.cpp	Mon Jan 23 20:34:18 2023 +0100
@@ -169,17 +169,17 @@
     int s;
 
     s = 2;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 0);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 0);
     s = 4;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 1);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 1);
     s = 6;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 2);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 2);
     s = 8;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 3);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 3);
     s = 10;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 4);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 4);
     s = -2;
-    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, false, cx_cmp_int, &s), 4);
+    EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 4);
 }
 
 TEST(LinkedList_LowLevel, cx_linked_list_compare) {
@@ -188,11 +188,11 @@
     auto tc = create_nodes_test_data({2, 4, 6, 9});
     auto la = ta.begin, lb = tb.begin, lc = tc.begin;
 
-    EXPECT_GT(cx_linked_list_compare(la, lb, loc_next, loc_data, false, false, cx_cmp_int), 0);
-    EXPECT_LT(cx_linked_list_compare(lb, la, loc_next, loc_data, false, false, cx_cmp_int), 0);
-    EXPECT_GT(cx_linked_list_compare(lc, la, loc_next, loc_data, false, false, cx_cmp_int), 0);
-    EXPECT_LT(cx_linked_list_compare(la, lc, loc_next, loc_data, false, false, cx_cmp_int), 0);
-    EXPECT_EQ(cx_linked_list_compare(la, la, loc_next, loc_data, false, false, cx_cmp_int), 0);
+    EXPECT_GT(cx_linked_list_compare(la, lb, loc_next, loc_data, cx_cmp_int), 0);
+    EXPECT_LT(cx_linked_list_compare(lb, la, loc_next, loc_data, cx_cmp_int), 0);
+    EXPECT_GT(cx_linked_list_compare(lc, la, loc_next, loc_data, cx_cmp_int), 0);
+    EXPECT_LT(cx_linked_list_compare(la, lc, loc_next, loc_data, cx_cmp_int), 0);
+    EXPECT_EQ(cx_linked_list_compare(la, la, loc_next, loc_data, cx_cmp_int), 0);
 }
 
 TEST(LinkedList_LowLevel, cx_linked_list_add) {
@@ -518,8 +518,7 @@
     void *begin = scrambled.begin;
     void *end = cx_linked_list_last(begin, loc_next);
 
-    cx_linked_list_sort(&begin, &end, loc_prev, loc_next, loc_data,
-                        false, cx_cmp_int);
+    cx_linked_list_sort(&begin, &end, loc_prev, loc_next, loc_data, cx_cmp_int);
 
     node *check = reinterpret_cast<node *>(begin);
     node *check_last = nullptr;
@@ -547,7 +546,7 @@
     cx_linked_list_reverse(&begin, &end, loc_prev, loc_next);
     EXPECT_EQ(end, orig_begin);
     EXPECT_EQ(begin, orig_end);
-    EXPECT_EQ(cx_linked_list_compare(begin, expected.begin, loc_next, loc_data, false, false, cx_cmp_int), 0);
+    EXPECT_EQ(cx_linked_list_compare(begin, expected.begin, loc_next, loc_data, cx_cmp_int), 0);
 }
 
 class HighLevelTest : public ::testing::Test {
@@ -574,13 +573,6 @@
         return list;
     }
 
-    auto pointerLinkedListFromTestData() const -> CxList * {
-        auto list = autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int));
-        // note: cannot use cxListAddArray() because we don't have a list of pointers
-        cx_for_n(i, testdata_len) cxListAdd(list, &testdata.data[i]);
-        return list;
-    }
-
     auto arrayListFromTestData() const -> CxList * {
         auto list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), testdata_len));
         cxListAddArray(list, testdata.data.data(), testdata_len);
@@ -795,9 +787,6 @@
 class LinkedList : public HighLevelTest {
 };
 
-class PointerLinkedList : public HighLevelTest {
-};
-
 class ArrayList : public HighLevelTest {
 };
 
@@ -809,14 +798,6 @@
     verifyCreate(list);
 }
 
-TEST_F(PointerLinkedList, cxPointerLinkedListCreate) {
-    CxList *list = autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int));
-    ASSERT_NE(list, nullptr);
-    EXPECT_EQ(list->itemsize, sizeof(void *));
-    EXPECT_EQ(list->capacity, (size_t) -1);
-    verifyCreate(list);
-}
-
 TEST_F(ArrayList, cxArrayListCreate) {
     CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8));
     ASSERT_NE(list, nullptr);
@@ -830,11 +811,6 @@
     verifyAdd(list, false);
 }
 
-TEST_F(PointerLinkedList, cxListAdd) {
-    CxList *list = autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int));
-    verifyAdd(list, true);
-}
-
 TEST_F(ArrayList, cxListAdd) {
     CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8));
     verifyAdd(list, false);
@@ -844,10 +820,6 @@
     verifyInsert(autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))));
 }
 
-TEST_F(PointerLinkedList, cxListInsert) {
-    verifyInsert(autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int)));
-}
-
 TEST_F(ArrayList, cxListInsert) {
     verifyInsert(autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 2)));
 }
@@ -856,11 +828,6 @@
     verifyInsertArray(autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))));
 }
 
-TEST_F(PointerLinkedList, cxListInsertArray) {
-    //TODO: this is unfixably broken - solve with issue #234
-    //verifyInsertArray(autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int)));
-}
-
 TEST_F(ArrayList, cxListInsertArray) {
     verifyInsertArray(autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 4)));
 }
@@ -869,10 +836,6 @@
     verifyRemove(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListRemove) {
-    verifyRemove(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, cxListRemove) {
     verifyRemove(arrayListFromTestData());
 }
@@ -881,10 +844,6 @@
     verifyAt(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListAt) {
-    verifyAt(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, cxListAt) {
     verifyAt(arrayListFromTestData());
 }
@@ -893,10 +852,6 @@
     verifyFind(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListFind) {
-    verifyFind(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, cxListFind) {
     verifyFind(arrayListFromTestData());
 }
@@ -905,10 +860,6 @@
     verifySort(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListSort) {
-    verifySort(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, cxListSort) {
     verifySort(arrayListFromTestData());
 }
@@ -917,10 +868,6 @@
     verifyIterator(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, Iterator) {
-    verifyIterator(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, Iterator) {
     verifyIterator(arrayListFromTestData());
 }
@@ -932,14 +879,6 @@
     verifyInsertViaIterator(list);
 }
 
-TEST_F(PointerLinkedList, InsertViaIterator) {
-    int fivenums[] = {0, 1, 2, 3, 4, 5};
-    CxList *list = autofree(cxPointerLinkedListCreate(&testingAllocator, cx_cmp_int));
-    // note: don't use cxListAddArray() here, because we don't have a list of pointers
-    cx_for_n (i, 5) cxListAdd(list, &fivenums[i]);
-    verifyInsertViaIterator(list);
-}
-
 TEST_F(ArrayList, InsertViaIterator) {
     int fivenums[] = {0, 1, 2, 3, 4, 5};
     CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 4));
@@ -951,10 +890,6 @@
     verifyReverse(linkedListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListReverse) {
-    verifyReverse(pointerLinkedListFromTestData());
-}
-
 TEST_F(ArrayList, cxListReverse) {
     verifyReverse(arrayListFromTestData());
 }
@@ -965,83 +900,20 @@
     verifyCompare(left, right);
 }
 
-TEST_F(LinkedList, cxListCompareWithPtrList) {
-    auto left = linkedListFromTestData();
-    auto right = pointerLinkedListFromTestData();
-    verifyCompare(left, right);
-}
-
 TEST_F(LinkedList, cxListCompareWithArrayList) {
     auto left = linkedListFromTestData();
     auto right = arrayListFromTestData();
     verifyCompare(left, right);
 }
 
-TEST_F(PointerLinkedList, cxListCompare) {
-    auto left = pointerLinkedListFromTestData();
-    auto right = pointerLinkedListFromTestData();
-    verifyCompare(left, right);
-}
-
-TEST_F(PointerLinkedList, cxListCompareWithNormalList) {
-    auto left = pointerLinkedListFromTestData();
-    auto right = linkedListFromTestData();
-    verifyCompare(left, right);
-}
-
-TEST_F(PointerLinkedList, cxListCompareWithArrayList) {
-    auto left = pointerLinkedListFromTestData();
-    auto right = arrayListFromTestData();
-    verifyCompare(left, right);
-}
-
 TEST_F(ArrayList, cxListCompare) {
     auto left = arrayListFromTestData();
     auto right = arrayListFromTestData();
     verifyCompare(left, right);
 }
 
-TEST_F(ArrayList, cxListCompareWithPtrList) {
-    auto left = arrayListFromTestData();
-    auto right = pointerLinkedListFromTestData();
-    verifyCompare(left, right);
-}
-
-TEST_F(ArrayList, cxListCompareWithNormalList) {
+TEST_F(ArrayList, cxListCompareWithLinkedList) {
     auto left = arrayListFromTestData();
     auto right = linkedListFromTestData();
     verifyCompare(left, right);
 }
-
-TEST_F(PointerLinkedList, NoDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxPointerLinkedListCreate(cxDefaultAllocator, cx_cmp_int);
-    cxListAdd(list, item);
-    ASSERT_FALSE(testingAllocator.verify());
-    cxListDestroy(list);
-    EXPECT_FALSE(testingAllocator.verify());
-    cxFree(&testingAllocator, item);
-    EXPECT_TRUE(testingAllocator.verify());
-}
-
-TEST_F(PointerLinkedList, SimpleDestructor) {
-    int item = 0;
-    auto list = cxPointerLinkedListCreate(cxDefaultAllocator, cx_cmp_int);
-    list->content_destructor_type = CX_DESTRUCTOR_SIMPLE;
-    list->simple_destructor = [](void *elem) { *(int *) elem = 42; };
-    cxListAdd(list, &item);
-    cxListDestroy(list);
-    EXPECT_EQ(item, 42);
-}
-
-TEST_F(PointerLinkedList, AdvancedDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxPointerLinkedListCreate(cxDefaultAllocator, cx_cmp_int);
-    list->content_destructor_type = CX_DESTRUCTOR_ADVANCED;
-    list->advanced_destructor.data = &testingAllocator;
-    list->advanced_destructor.func = (cx_destructor_func2) cxFree;
-    cxListAdd(list, item);
-    ASSERT_FALSE(testingAllocator.verify());
-    cxListDestroy(list);
-    EXPECT_TRUE(testingAllocator.verify());
-}

mercurial