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() { ...@@ -31,10 +31,8 @@ void test_cursor_current() {
unlink(fname); unlink(fname);
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0); assert(r == 0);
assert(r == 0); r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666);
assert(r == 0);
int k = 42, v = 42000; int k = 42, v = 42000;
db_put(db, k, v); db_put(db, k, v);
...@@ -42,11 +40,13 @@ void test_cursor_current() { ...@@ -42,11 +40,13 @@ void test_cursor_current() {
DBC *cursor; DBC *cursor;
r = db->cursor(db, null_txn, &cursor, 0); r = db->cursor(db, null_txn, &cursor, 0); assert(r == 0);
assert(r == 0);
DBT key, data; int kk, vv; 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); r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == EINVAL); assert(r == EINVAL);
...@@ -76,11 +76,15 @@ void test_cursor_current() { ...@@ -76,11 +76,15 @@ void test_cursor_current() {
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT); r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == DB_KEYEMPTY); assert(r == DB_KEYEMPTY);
r = cursor->c_close(cursor); r = cursor->c_del(cursor, 0);
assert(r == 0); assert(r == DB_KEYEMPTY);
r = db->close(db, 0); r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&data), DB_CURRENT);
assert(r == 0); 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) { void db_get(DB *db, int k, int v, int expectr) {
...@@ -98,15 +102,12 @@ void test_reopen() { ...@@ -98,15 +102,12 @@ void test_reopen() {
const char * const fname = DIR "/" "test.cursor.current.brt"; const char * const fname = DIR "/" "test.cursor.current.brt";
int r; int r;
r = db_create(&db, null_env, 0); r = db_create(&db, null_env, 0); assert(r == 0);
assert(r == 0); r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666); 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); db_get(db, 1, 1, DB_NOTFOUND);
r = db->close(db, 0); r = db->close(db, 0); assert(r == 0);
assert(r == 0);
} }
int main(int argc, const char *argv[]) { 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