First attempt to make RAII cursors, no tests yet
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 40s
All checks were successful
Main LMDBAL workfow / Archlinux (push) Successful in 40s
This commit is contained in:
parent
a0eebc978d
commit
96d7d9ef64
12 changed files with 374 additions and 233 deletions
|
@ -337,15 +337,15 @@ TEST_F(DuplicatesTest, GettingAllRecords) {
|
|||
|
||||
std::map<int16_t, uint16_t> m1;
|
||||
std::set<int16_t> k1;
|
||||
LMDBAL::Cursor<int16_t, uint16_t>* c1 = tu1->createCursor();
|
||||
LMDBAL::Cursor<int16_t, uint16_t> c1 = tu1->createCursor();
|
||||
tu1->readAll(m1, txn);
|
||||
c1->open(txn);
|
||||
c1.open(txn);
|
||||
|
||||
cycle = false;
|
||||
iterations = 0;
|
||||
do {
|
||||
try {
|
||||
std::pair<int16_t, uint16_t> pair = c1->next();
|
||||
std::pair<int16_t, uint16_t> pair = c1.next();
|
||||
cycle = true;
|
||||
std::pair<std::set<int16_t>::const_iterator, bool> probe = k1.insert(pair.first);
|
||||
if (probe.second) {
|
||||
|
@ -359,25 +359,25 @@ TEST_F(DuplicatesTest, GettingAllRecords) {
|
|||
cycle = false;
|
||||
}
|
||||
} while (cycle);
|
||||
tu1->destroyCursor(c1);
|
||||
|
||||
EXPECT_EQ(iterations, tu1->count(txn));
|
||||
EXPECT_EQ(k1.size(), m1.size());
|
||||
EXPECT_NE(iterations, 0);
|
||||
EXPECT_NE(k1.size(), 0);
|
||||
c1.drop();
|
||||
|
||||
|
||||
std::map<std::string, int8_t> m2;
|
||||
std::set<std::string> k2;
|
||||
LMDBAL::Cursor<std::string, int8_t>* c2 = tu2->createCursor();
|
||||
LMDBAL::Cursor<std::string, int8_t> c2 = tu2->createCursor();
|
||||
tu2->readAll(m2, txn);
|
||||
c2->open(txn);
|
||||
c2.open(txn);
|
||||
|
||||
cycle = false;
|
||||
iterations = 0;
|
||||
do {
|
||||
try {
|
||||
std::pair<std::string, int8_t> pair = c2->next();
|
||||
std::pair<std::string, int8_t> pair = c2.next();
|
||||
cycle = true;
|
||||
std::pair<std::set<std::string>::const_iterator, bool> probe = k2.insert(pair.first);
|
||||
if (probe.second) {
|
||||
|
@ -391,25 +391,25 @@ TEST_F(DuplicatesTest, GettingAllRecords) {
|
|||
cycle = false;
|
||||
}
|
||||
} while (cycle);
|
||||
tu2->destroyCursor(c2);
|
||||
|
||||
EXPECT_EQ(iterations, tu2->count(txn));
|
||||
EXPECT_EQ(k2.size(), m2.size());
|
||||
EXPECT_NE(iterations, 0);
|
||||
EXPECT_NE(k2.size(), 0);
|
||||
c2.drop();
|
||||
|
||||
|
||||
std::map<float, float> m3;
|
||||
std::set<float> k3;
|
||||
LMDBAL::Cursor<float, float>* c3 = tu3->createCursor();
|
||||
LMDBAL::Cursor<float, float> c3 = tu3->createCursor();
|
||||
tu3->readAll(m3, txn);
|
||||
c3->open(txn);
|
||||
c3.open(txn);
|
||||
|
||||
cycle = false;
|
||||
iterations = 0;
|
||||
do {
|
||||
try {
|
||||
std::pair<float, float> pair = c3->next();
|
||||
std::pair<float, float> pair = c3.next();
|
||||
cycle = true;
|
||||
std::pair<std::set<float>::const_iterator, bool> probe = k3.insert(pair.first);
|
||||
if (probe.second) {
|
||||
|
@ -423,25 +423,25 @@ TEST_F(DuplicatesTest, GettingAllRecords) {
|
|||
cycle = false;
|
||||
}
|
||||
} while (cycle);
|
||||
tu3->destroyCursor(c3);
|
||||
|
||||
EXPECT_EQ(iterations, tu3->count(txn));
|
||||
EXPECT_EQ(k3.size(), m3.size());
|
||||
EXPECT_NE(iterations, 0);
|
||||
EXPECT_NE(k3.size(), 0);
|
||||
c3.drop();
|
||||
|
||||
|
||||
std::map<uint16_t, double> m4;
|
||||
std::set<uint16_t> k4;
|
||||
LMDBAL::Cursor<uint16_t, double>* c4 = tu4->createCursor();
|
||||
LMDBAL::Cursor<uint16_t, double> c4 = tu4->createCursor();
|
||||
tu4->readAll(m4, txn);
|
||||
c4->open(txn);
|
||||
c4.open(txn);
|
||||
|
||||
cycle = false;
|
||||
iterations = 0;
|
||||
do {
|
||||
try {
|
||||
std::pair<uint16_t, double> pair = c4->next();
|
||||
std::pair<uint16_t, double> pair = c4.next();
|
||||
cycle = true;
|
||||
std::pair<std::set<uint16_t>::const_iterator, bool> probe = k4.insert(pair.first);
|
||||
if (probe.second) {
|
||||
|
@ -455,7 +455,7 @@ TEST_F(DuplicatesTest, GettingAllRecords) {
|
|||
cycle = false;
|
||||
}
|
||||
} while (cycle);
|
||||
tu4->destroyCursor(c4);
|
||||
c4.drop();
|
||||
|
||||
EXPECT_EQ(iterations, tu4->count(txn));
|
||||
EXPECT_EQ(k4.size(), m4.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue