From 5787ff052d30e4b6f31a52e51d2ba2e2f9651488 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 11 Oct 2021 09:54:36 +0800 Subject: [PATCH] add test --- .../server/vnode/test/vnodeMemAllocatorTest.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/server/vnode/test/vnodeMemAllocatorTest.cpp b/source/server/vnode/test/vnodeMemAllocatorTest.cpp index 4de717d80d..f2d07e6aa5 100644 --- a/source/server/vnode/test/vnodeMemAllocatorTest.cpp +++ b/source/server/vnode/test/vnodeMemAllocatorTest.cpp @@ -4,5 +4,19 @@ #include "vnodeMemAllocator.h" TEST(VMATest, basic_create_and_destroy_test) { - std::cout << "Hello, this is VMA test" << std::endl; + SVnodeMemAllocator *vma = VMACreate(1024, 512, 64); + EXPECT_TRUE(vma != nullptr); + EXPECT_EQ(vma->full, false); + EXPECT_EQ(vma->ssize, 512); + EXPECT_EQ(vma->threshold, 64); + EXPECT_EQ(vma->inuse->tsize, 1024); + VMADestroy(vma); + + vma = VMACreate(1024, 512, 1024); + EXPECT_TRUE(vma != nullptr); + VMADestroy(vma); + + vma = VMACreate(1024, 512, 1025); + EXPECT_TRUE(vma == nullptr); + VMADestroy(vma); } \ No newline at end of file