From e835a6cc3992e70c396c3b66c7662cb990d7ef55 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 15 Feb 2022 03:54:25 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/test/CMakeLists.txt | 6 +++--- source/libs/tdb/test/tdbTest.cpp | 31 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/source/libs/tdb/test/CMakeLists.txt b/source/libs/tdb/test/CMakeLists.txt index 5cac816493..2d77c1f4e9 100644 --- a/source/libs/tdb/test/CMakeLists.txt +++ b/source/libs/tdb/test/CMakeLists.txt @@ -1,3 +1,3 @@ -# # tdbTest -# add_executable(tdbTest "tdbTest.cpp") -# target_link_libraries(tdbTest tdb gtest gtest_main) \ No newline at end of file +# tdbTest +add_executable(tdbTest "tdbTest.cpp") +target_link_libraries(tdbTest tdb gtest gtest_main) \ No newline at end of file diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 113bb2560f..93eeef7b32 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -2,13 +2,32 @@ #include "tdb.h" -TEST(tdb_api_test, tdb_create_open_close_db_test) { - // int ret; - // TDB *dbp; +#define A_ASSERT(op) GTEST_ASSERT_EQ(op, 0) - // tdbCreateDB(&dbp, TDB_BTREE_T); +TEST(tdb_test, simple_test) { + TENV *pEnv; + TDB * pDb1, *pDb2; - // tdbOpenDB(dbp, 0); + // ENV + tdbEnvCreate(&pEnv); + tdbEnvSetPageSize(pEnv, 1024); + tdbEnvSetCacheSize(pEnv, 10240); + tdbEnvOpen(&pEnv); - // tdbCloseDB(dbp, 0); + // DB + tdbOpen(&pDb1, "db.db", "db1", pEnv); + tdbOpen(&pDb2, "db.db", "db2", pEnv); + + // Insert + + // Query + + // Delete + + // Query + + // Close + tdbClose(pDb1); + tdbClose(pDb2); + tdbEnvClose(pEnv); } \ No newline at end of file -- GitLab