提交 0b12117f 编写于 作者: H Hongze Cheng

fix a test bug

上级 fc64a2c7
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include "tdbInt.h" #include "tdbInt.h"
#include <string>
static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2); static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2);
...@@ -11,7 +13,6 @@ TEST(tdb_test, simple_test) { ...@@ -11,7 +13,6 @@ TEST(tdb_test, simple_test) {
STDB *pDb; STDB *pDb;
FKeyComparator compFunc; FKeyComparator compFunc;
int nData = 10000000; int nData = 10000000;
// int nData = 8508;
// Open Env // Open Env
ret = tdbEnvOpen("tdb", 4096, 256000, &pEnv); ret = tdbEnvOpen("tdb", 4096, 256000, &pEnv);
...@@ -98,8 +99,10 @@ TEST(tdb_test, simple_test) { ...@@ -98,8 +99,10 @@ TEST(tdb_test, simple_test) {
static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) { static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) {
int k1, k2; int k1, k2;
k1 = std::strtol((char *)pKey1 + 3, nullptr, 10); std::string s1((char *)pKey1 + 3, kLen1 - 3);
k2 = std::strtol((char *)pKey2 + 3, nullptr, 10); std::string s2((char *)pKey2 + 3, kLen2 - 3);
k1 = stoi(s1);
k2 = stoi(s2);
if (k1 < k2) { if (k1 < k2) {
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册