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

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

H
Hongze Cheng 已提交
5
TEST(tdb_test, simple_test) {
H
Hongze Cheng 已提交
6 7 8 9
  TENV*     pEnv;
  TDB *     pDb1, *pDb2, *pDb3;
  pgsz_t    pgSize = 1024;
  cachesz_t cacheSize = 10240;
H
more  
Hongze Cheng 已提交
10

H
Hongze Cheng 已提交
11
  // ENV
H
Hongze Cheng 已提交
12 13 14 15 16 17 18 19 20
  GTEST_ASSERT_EQ(tdbEnvCreate(&pEnv, "./tdbtest"), 0);

  GTEST_ASSERT_EQ(tdbEnvSetCache(pEnv, pgSize, cacheSize), 0);

  GTEST_ASSERT_EQ(tdbEnvGetCacheSize(pEnv), cacheSize);

  GTEST_ASSERT_EQ(tdbEnvGetPageSize(pEnv), pgSize);

  GTEST_ASSERT_EQ(tdbEnvOpen(pEnv), 0);
H
Hongze Cheng 已提交
21

H
Hongze Cheng 已提交
22
#if 0
H
Hongze Cheng 已提交
23 24 25
  // DB
  tdbOpen(&pDb1, "db.db", "db1", pEnv);
  tdbOpen(&pDb2, "db.db", "db2", pEnv);
H
Hongze Cheng 已提交
26
  tdbOpen(&pDb3, "index.db", NULL, pEnv);
H
Hongze Cheng 已提交
27 28 29 30 31 32 33 34 35 36 37 38

  // Insert

  // Query

  // Delete

  // Query

  // Close
  tdbClose(pDb1);
  tdbClose(pDb2);
H
Hongze Cheng 已提交
39
#endif
H
Hongze Cheng 已提交
40
  tdbEnvClose(pEnv);
H
Hongze Cheng 已提交
41
}