Skip to content

Instantly share code, notes, and snippets.

@philsquared
Created January 14, 2019 10:09
Show Gist options
  • Save philsquared/85cbbca8f1fa5f03b6b69541f8dabce1 to your computer and use it in GitHub Desktop.
Save philsquared/85cbbca8f1fa5f03b6b69541f8dabce1 to your computer and use it in GitHub Desktop.
Kellabyte's rewind tests using plain SECTIONs (depends on https://gist.github.com/philsquared/567fdd233d574fe1957d17aff3e5d02c)
TEST_CASE("initialize rewind", "[rewind]") {
int rc;
MDB_env *env;
MDB_dbi dbi;
MDB_txn *txn;
SECTION("create and open an environment") {
REQUIRE(SuccessFrom(mdb_env_create(&env)));
REQUIRE(SuccessFrom(mdb_env_set_mapsize(env, size_t(1048576000))));
REQUIRE(SuccessFrom(mdb_env_set_maxdbs(env, 1024)));
REQUIRE(SuccessFrom(mdb_env_open(env, "/tmp", MDB_FIXEDMAP /*|MDB_NOSYNC*/, 0664)));
SECTION("begin a transaction") {
REQUIRE(SuccessFrom(mdb_txn_begin(env, NULL, 0, &txn)));
REQUIRE(SuccessFrom(mdb_dbi_open(txn, NULL, 0, &dbi)));
REQUIRE(SuccessFrom(mdb_open(txn, NULL, 0, &dbi)));
SECTION("commit the transaction") {
REQUIRE(SuccessFrom(mdb_txn_commit(txn)));
}
}
}
mdb_dbi_close(env, dbi);
mdb_env_close(env);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment