tests/test_list.cpp

changeset 801
04aa3913c0e3
parent 800
1274e46b3013
--- a/tests/test_list.cpp	Tue Jan 09 21:25:08 2024 +0100
+++ b/tests/test_list.cpp	Wed Jan 10 22:13:23 2024 +0100
@@ -848,153 +848,5 @@
     verifyAdvancedDestructor(pointerArrayListFromTestData());
 }
 
-TEST_F(PointerLinkedList, cxListStorePointers) {
-    auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, 47));
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-    cxListStorePointers(list);
-    EXPECT_EQ(list->item_size, sizeof(void *));
-    CX_TEST_ASSERT(list->cl != NULL);
-    CX_TEST_ASSERT(list->climpl != NULL);
-    CX_TEST_ASSERT(cxListIsStoringPointers(list));
-    cxListStoreObjects(list);
-    CX_TEST_ASSERT(list->cl != NULL);
-    EXPECT_EQ(list->climpl, NULL);
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-}
-
-TEST_F(LinkedList, cxLinkedListCreate) {
-    CxList *list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int)));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->item_size, sizeof(int));
-    EXPECT_EQ(list->simple_destructor, NULL);
-    EXPECT_EQ(list->advanced_destructor, NULL);
-    EXPECT_EQ(list->destructor_data, NULL);
-    EXPECT_EQ(cxListSize(list), 0);
-    EXPECT_EQ(list->allocator, &testingAllocator);
-    EXPECT_EQ(list->cmpfunc, cx_cmp_int);
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-}
-
-TEST_F(LinkedList, cxLinkedListCreateSimple) {
-    CxList *list = autofree(cxLinkedListCreateSimple(sizeof(int)));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->item_size, sizeof(int));
-    EXPECT_EQ(list->cmpfunc, NULL);
-    EXPECT_EQ(list->allocator, cxDefaultAllocator);
-    EXPECT_EQ(list->simple_destructor, NULL);
-    EXPECT_EQ(list->advanced_destructor, NULL);
-    EXPECT_EQ(list->destructor_data, NULL);
-    EXPECT_EQ(cxListSize(list), 0);
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-}
-
-TEST_F(PointerLinkedList, cxLinkedListCreateSimpleForPointers) {
-    CxList *list = autofree(cxLinkedListCreateSimple(CX_STORE_POINTERS));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->item_size, sizeof(void *));
-    EXPECT_EQ(list->cmpfunc, cx_cmp_ptr);
-    EXPECT_EQ(list->allocator, cxDefaultAllocator);
-    EXPECT_EQ(list->simple_destructor, NULL);
-    EXPECT_EQ(list->advanced_destructor, NULL);
-    EXPECT_EQ(list->destructor_data, NULL);
-    EXPECT_EQ(cxListSize(list), 0);
-    CX_TEST_ASSERT(cxListIsStoringPointers(list));
-}
-
-TEST_F(ArrayList, cxArrayListCreate) {
-    CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->item_size, sizeof(int));
-    EXPECT_EQ(list->simple_destructor, NULL);
-    EXPECT_EQ(list->advanced_destructor, NULL);
-    EXPECT_EQ(list->destructor_data, NULL);
-    EXPECT_EQ(cxListSize(list), 0);
-    EXPECT_EQ(list->allocator, &testingAllocator);
-    EXPECT_EQ(list->cmpfunc, cx_cmp_int);
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-}
 
-TEST_F(ArrayList, cxArrayListCreateSimple) {
-    CxList *list = autofree(cxArrayListCreateSimple(sizeof(int), 8));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->cmpfunc, NULL);
-    EXPECT_EQ(list->allocator, cxDefaultAllocator);
-    EXPECT_EQ(list->item_size, sizeof(int));
-    EXPECT_EQ(list->simple_destructor, NULL);
-    EXPECT_EQ(list->advanced_destructor, NULL);
-    EXPECT_EQ(list->destructor_data, NULL);
-    EXPECT_EQ(cxListSize(list), 0);
-    CX_TEST_ASSERT(!cxListIsStoringPointers(list));
-}
 
-TEST_F(PointerArrayList, cxArrayListCreateSimpleForPointers) {
-    CxList *list = autofree(cxArrayListCreateSimple(CX_STORE_POINTERS, 8));
-    ASSERT_NE(list, NULL);
-    EXPECT_EQ(list->cmpfunc, cx_cmp_ptr);
-    EXPECT_EQ(list->allocator, cxDefaultAllocator);
-    EXPECT_EQ(list->item_size, sizeof(void *));
-    CX_TEST_ASSERT(cxListIsStoringPointers(list));
-}
-
-TEST_F(PointerLinkedList, DestroyNoDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS);
-    cxListAdd(list, item);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxListDestroy(list);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxFree(&testingAllocator, item);
-    CX_TEST_ASSERT(testingAllocator.verify());
-}
-
-TEST_F(PointerLinkedList, DestroySimpleDestructor) {
-    int item = 0;
-    auto list = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS);
-    list->simple_destructor = [](void *elem) { *(int *) elem = 42; };
-    cxListAdd(list, &item);
-    cxListDestroy(list);
-    EXPECT_EQ(item, 42);
-}
-
-TEST_F(PointerLinkedList, DestroyAdvancedDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxLinkedListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS);
-    list->destructor_data = &testingAllocator;
-    list->advanced_destructor = (cx_destructor_func2) cxFree;
-    cxListAdd(list, item);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxListDestroy(list);
-    CX_TEST_ASSERT(testingAllocator.verify());
-}
-
-TEST_F(PointerArrayList, DestroyNoDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS, 4);
-    cxListAdd(list, item);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxListDestroy(list);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxFree(&testingAllocator, item);
-    CX_TEST_ASSERT(testingAllocator.verify());
-}
-
-TEST_F(PointerArrayList, DestroySimpleDestructor) {
-    int item = 0;
-    auto list = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS, 4);
-    list->simple_destructor = [](void *elem) { *(int *) elem = 42; };
-    cxListAdd(list, &item);
-    cxListDestroy(list);
-    EXPECT_EQ(item, 42);
-}
-
-TEST_F(PointerArrayList, DestroyAdvancedDestructor) {
-    void *item = cxMalloc(&testingAllocator, sizeof(int));
-    auto list = cxArrayListCreate(cxDefaultAllocator, cx_cmp_int, CX_STORE_POINTERS, 4);
-    list->destructor_data = &testingAllocator;
-    list->advanced_destructor = (cx_destructor_func2) cxFree;
-    cxListAdd(list, item);
-    CX_TEST_ASSERT(!testingAllocator.verify());
-    cxListDestroy(list);
-    CX_TEST_ASSERT(testingAllocator.verify());
-}
-

mercurial