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

@ -24,6 +24,7 @@ protected:
}
static void TearDownTestSuite() {
transaction.terminate();
db->close();
db->removeDirectory();
delete db;
@ -35,7 +36,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::Cache<uint64_t, std::string>* cache;
LMDBAL::Cache<uint64_t, std::string>* emptyCache;
@ -44,7 +45,7 @@ protected:
LMDBAL::Base* CacheCursorTest::db = nullptr;
LMDBAL::Cursor<uint64_t, std::string>* CacheCursorTest::cursor = nullptr;
LMDBAL::Cursor<uint64_t, std::string>* CacheCursorTest::emptyCursor = nullptr;
LMDBAL::TransactionID CacheCursorTest::transaction = nullptr;
LMDBAL::Transaction CacheCursorTest::transaction;
static const std::map<uint64_t, std::string> data({
{245665783, "bothering nerds"},
@ -288,7 +289,7 @@ TEST_F(CacheCursorTest, CurrentPublic) {
}
TEST_F(CacheCursorTest, CornerCases) {
db->abortTransaction(transaction);
transaction.terminate();
EXPECT_THROW(cursor->current(), LMDBAL::Unknown);
cursor->close();