2007-12-29 16:21:58 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <db_cxx.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2008-05-09 22:14:39 +00:00
|
|
|
#define FNAME __FILE__ ".tdb"
|
|
|
|
|
2013-04-16 23:57:25 -04:00
|
|
|
#define TC(expr, expect) \
|
2007-12-29 16:21:58 +00:00
|
|
|
try { \
|
|
|
|
expr; \
|
|
|
|
assert(expect==0); \
|
|
|
|
} catch (DbException e) { \
|
|
|
|
if (e.get_errno()!=expect) fprintf(stderr, "err=%d %s\n", e.get_errno(), db_strerror(e.get_errno())); \
|
|
|
|
assert(e.get_errno()==expect); \
|
2013-04-16 23:57:25 -04:00
|
|
|
}
|
2007-12-29 16:21:58 +00:00
|
|
|
|
|
|
|
void test_no_env () {
|
|
|
|
#if 0
|
|
|
|
DbEnv env(0);
|
|
|
|
TC(env.open(".", DB_INIT_MPOOL | DB_CREATE | DB_PRIVATE , 0777), 0);
|
|
|
|
Db db(&env, 0);
|
|
|
|
#else
|
|
|
|
Db db(0, 0);
|
|
|
|
#endif
|
2008-05-09 22:14:39 +00:00
|
|
|
unlink(FNAME);
|
|
|
|
TC(db.open(0, FNAME, 0, DB_BTREE, DB_CREATE, 0777), 0);
|
2007-12-29 16:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
test_no_env();
|
|
|
|
system("rm -f *.tokulog");
|
|
|
|
return 0;
|
|
|
|
}
|