Commit e202a52f authored by Rich Prohaska's avatar Rich Prohaska

test more c_del return values. addresses #250

git-svn-id: file:///svn/tokudb@1736 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9e352f52
......@@ -31,10 +31,8 @@ void test_cursor_current() {
unlink(fname);
r = db_create(&db, null_env, 0);
assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666);
assert(r == 0);
r = db_create(&db, null_env, 0); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
int k = 42, v = 42000;
db_put(db, k, v);
......@@ -42,11 +40,13 @@ void test_cursor_current() {
DBC *cursor;
r = db->cursor(db, null_txn, &cursor, 0);
assert(r == 0);
r = db->cursor(db, null_txn, &cursor, 0); assert(r == 0);
DBT key, data; int kk, vv;
r = cursor->c_del(cursor, 0);
assert(r == EINVAL);
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == EINVAL);
......@@ -76,11 +76,15 @@ void test_cursor_current() {
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == DB_KEYEMPTY);
r = cursor->c_close(cursor);
assert(r == 0);
r = cursor->c_del(cursor, 0);
assert(r == DB_KEYEMPTY);
r = db->close(db, 0);
assert(r == 0);
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == DB_KEYEMPTY);
r = cursor->c_close(cursor); assert(r == 0);
r = db->close(db, 0); assert(r == 0);
}
void db_get(DB *db, int k, int v, int expectr) {
......@@ -98,15 +102,12 @@ void test_reopen() {
const char * const fname = DIR "/" "test.cursor.current.brt";
int r;
r = db_create(&db, null_env, 0);
assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666);
assert(r == 0);
r = db_create(&db, null_env, 0); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666); assert(r == 0);
db_get(db, 1, 1, DB_NOTFOUND);
r = db->close(db, 0);
assert(r == 0);
r = db->close(db, 0); assert(r == 0);
}
int main(int argc, const char *argv[]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment