tdbTest.cpp 490 字节
Newer Older
H
Hongze Cheng 已提交
1 2
#include "gtest/gtest.h"

H
Hongze Cheng 已提交
3
#include "tdbInt.h"
H
more  
Hongze Cheng 已提交
4

H
Hongze Cheng 已提交
5
TEST(tdb_test, simple_test) {
H
Hongze Cheng 已提交
6 7 8
  int    ret;
  STEnv *pEnv;
  STDb *pDb;
H
more  
Hongze Cheng 已提交
9

H
Hongze Cheng 已提交
10 11 12
  // Open Env
  ret = tdbEnvOpen("tdb", 1024, 20, &pEnv);
  GTEST_ASSERT_EQ(ret, 0);
H
Hongze Cheng 已提交
13

H
Hongze Cheng 已提交
14 15 16
  // Create a database
  ret = tdbDbOpen(&pDb);
  GTEST_ASSERT_EQ(ret, 0);
H
Hongze Cheng 已提交
17

H
Hongze Cheng 已提交
18 19 20
  // Insert some data
  ret = tdbDbInsert(pDb, "1", 1, "world", 5);
  GTEST_ASSERT_EQ(ret, 0);
H
Hongze Cheng 已提交
21

H
Hongze Cheng 已提交
22 23
  // Close a database
  tdbDbClose(pDb);
H
Hongze Cheng 已提交
24

H
Hongze Cheng 已提交
25 26 27
  // Close Env
  ret = tdbEnvClose(pEnv);
  GTEST_ASSERT_EQ(ret, 0);
H
Hongze Cheng 已提交
28
}