Skip to content

Commit

Permalink
test: no previous values after compaction
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Jan 23, 2012
1 parent 5c5e0e4 commit b9123dc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/api.cc
Expand Up @@ -65,6 +65,27 @@ TEST_START("API test", "api")

assert(bp_compact(&db) == BP_OK);

for (i = 0; i < n; i++) {
bp_key_t kkey;
bp_value_t result;
bp_value_t previous;

sprintf(key, "some key %d", i);

kkey.length = strlen(key) + 1;
kkey.value = key;

/* new values should be in place */
sprintf(expected, "some another value %d", i);
assert(bp_get(&db, &kkey, &result) == BP_OK);
assert(strcmp(result.value, expected) == 0);

/* previous should be not available after compaction */
assert(bp_get_previous(&db, &result, &previous) == BP_ENOTFOUND);

free(result.value);
}

for (i = 0; i < n; i++) {
sprintf(key, "some key %d", i);
assert(bp_removes(&db, key) == BP_OK);
Expand Down

0 comments on commit b9123dc

Please sign in to comment.