vnodeMemAllocatorTest.cpp 536 字节
Newer Older
H
Hongze Cheng 已提交
1 2 3 4 5 6
#include <gtest/gtest.h>
#include <iostream>

#include "vnodeMemAllocator.h"

TEST(VMATest, basic_create_and_destroy_test) {
H
Hongze Cheng 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
  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);
H
Hongze Cheng 已提交
22
}