--- a/test/test_basic_mempool.cpp Wed Aug 03 17:27:55 2022 +0200 +++ b/test/test_basic_mempool.cpp Mon Aug 08 17:12:00 2022 +0200 @@ -32,19 +32,17 @@ class CxBasicMempool : public ::testing::Test { protected: - CxTestingAllocator testingAllocator; CxMempool *pool = nullptr; void TearDown() override { if (pool != nullptr) { cxMempoolDestroy(pool); } - EXPECT_TRUE(testingAllocator.verify()); } }; TEST_F(CxBasicMempool, Create) { - pool = cxBasicMempoolCreateSimple(16); + pool = cxBasicMempoolCreate(16); ASSERT_NE(pool->allocator, nullptr); ASSERT_NE(pool->cl, nullptr); EXPECT_NE(pool->cl->destroy, nullptr); @@ -56,41 +54,35 @@ EXPECT_NE(pool->allocator->cl->free, nullptr); auto basic_pool = reinterpret_cast<cx_basic_mempool_s *>(pool); - EXPECT_EQ(basic_pool->allocator, cxDefaultAllocator); EXPECT_EQ(basic_pool->size, 16); EXPECT_EQ(basic_pool->ndata, 0); EXPECT_NE(basic_pool->data, nullptr); } TEST_F(CxBasicMempool, malloc) { - pool = cxBasicMempoolCreate(4, &testingAllocator); + pool = cxBasicMempoolCreate(4); auto basic_pool = reinterpret_cast<cx_basic_mempool_s *>(pool); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); - EXPECT_EQ(testingAllocator.alloc_total, 2); EXPECT_EQ(basic_pool->ndata, 2); EXPECT_EQ(basic_pool->size, 4); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); - EXPECT_EQ(testingAllocator.alloc_total, 4); EXPECT_EQ(basic_pool->ndata, 4); EXPECT_EQ(basic_pool->size, 4); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); EXPECT_NE(cxMalloc(pool->allocator, sizeof(int)), nullptr); - EXPECT_EQ(testingAllocator.alloc_total, 6); EXPECT_EQ(basic_pool->ndata, 6); EXPECT_GE(basic_pool->size, 6); - EXPECT_TRUE(testingAllocator.used()); } TEST_F(CxBasicMempool, calloc) { - pool = cxBasicMempoolCreate(4, &testingAllocator); + pool = cxBasicMempoolCreate(4); auto test = (int *) cxCalloc(pool->allocator, 2, sizeof(int)); ASSERT_NE(test, nullptr); EXPECT_EQ(test[0], 0); EXPECT_EQ(test[1], 0); - EXPECT_TRUE(testingAllocator.used()); } static unsigned test_destructor_called = 0; @@ -100,7 +92,7 @@ } TEST_F(CxBasicMempool, destructor) { - pool = cxBasicMempoolCreate(4, &testingAllocator); + pool = cxBasicMempoolCreate(4); auto data = cxMalloc(pool->allocator, sizeof(int)); *((int *) data) = 13; cxMempoolSetDestructor(pool, data, test_destructor); @@ -116,7 +108,7 @@ } TEST_F(CxBasicMempool, realloc) { - pool = cxBasicMempoolCreate(4, &testingAllocator); + pool = cxBasicMempoolCreate(4); auto data = cxMalloc(pool->allocator, sizeof(int)); *((int *) data) = 13; cxMempoolSetDestructor(pool, data, test_destructor); @@ -138,7 +130,7 @@ TEST_F(CxBasicMempool, free) { - pool = cxBasicMempoolCreate(4, &testingAllocator); + pool = cxBasicMempoolCreate(4); auto basic_pool = reinterpret_cast<cx_basic_mempool_s *>(pool); void *mem1;