提交 4e6ea0d2 编写于 作者: H Hongze Cheng

new test

上级 0492362f
...@@ -121,7 +121,7 @@ TEST(tdb_test, simple_test) { ...@@ -121,7 +121,7 @@ TEST(tdb_test, simple_test) {
int nData = 1000000; int nData = 1000000;
// Open Env // Open Env
ret = tdbEnvOpen("tdb", 4096, 256000, &pEnv); ret = tdbEnvOpen("tdb", 4096, 100, &pEnv);
GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(ret, 0);
// Create a database // Create a database
...@@ -134,21 +134,19 @@ TEST(tdb_test, simple_test) { ...@@ -134,21 +134,19 @@ TEST(tdb_test, simple_test) {
char val[64]; char val[64];
{ // Insert some data { // Insert some data
tdbBegin(pEnv); for (int i = 1; i <= nData;) {
tdbBegin(pEnv);
int i = 1;
for (;;) { for (int k = 0; k < 10; k++) {
if (i > nData) break; sprintf(key, "key%d", i);
sprintf(val, "value%d", i);
sprintf(key, "key%d", i); ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val));
sprintf(val, "value%d", i); GTEST_ASSERT_EQ(ret, 0);
ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val)); i++;
GTEST_ASSERT_EQ(ret, 0); }
i++; tdbCommit(pEnv);
} }
tdbCommit(pEnv);
} }
{ // Query the data { // Query the data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册