RAII transactions
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 40s

This commit is contained in:
Blue 2023-10-17 18:06:11 -03:00
parent a9aa6b549f
commit de741eda21
Signed by: blue
GPG key ID: 9B203B252A63EE38
22 changed files with 689 additions and 222 deletions

View file

@ -23,6 +23,7 @@ protected:
}
static void TearDownTestSuite() {
transaction.terminate();
db->close();
db->removeDirectory();
delete db;
@ -34,7 +35,7 @@ protected:
static LMDBAL::Base* db;
static LMDBAL::Cursor<uint64_t, std::string>* cursor;
static LMDBAL::Cursor<uint64_t, std::string>* emptyCursor;
static LMDBAL::TransactionID transaction;
static LMDBAL::Transaction transaction;
LMDBAL::Storage<uint64_t, std::string>* table;
LMDBAL::Storage<uint64_t, std::string>* emptyTable;
@ -43,7 +44,7 @@ protected:
LMDBAL::Base* StorageCursorTest::db = nullptr;
LMDBAL::Cursor<uint64_t, std::string>* StorageCursorTest::cursor = nullptr;
LMDBAL::Cursor<uint64_t, std::string>* StorageCursorTest::emptyCursor = nullptr;
LMDBAL::TransactionID StorageCursorTest::transaction = nullptr;
LMDBAL::Transaction StorageCursorTest::transaction = LMDBAL::Transaction();
static const std::map<uint64_t, std::string> data({
{245665783, "bothering nerds"},
@ -265,7 +266,7 @@ TEST_F(StorageCursorTest, CurrentPublic) {
}
TEST_F(StorageCursorTest, CornerCases) {
db->abortTransaction(transaction);
transaction.terminate();
EXPECT_THROW(cursor->current(), LMDBAL::Unknown);
cursor->close();