Changeset View
Changeset View
Standalone View
Standalone View
src/test/dbwrapper_tests.cpp
Show First 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(iterator_ordering) { | ||||
for (unsigned int x = 0x00; x < 256; ++x) { | for (unsigned int x = 0x00; x < 256; ++x) { | ||||
uint8_t key = x; | uint8_t key = x; | ||||
uint32_t value = x * x; | uint32_t value = x * x; | ||||
if (x & 1) { | if (x & 1) { | ||||
BOOST_CHECK(dbw.Write(key, value)); | BOOST_CHECK(dbw.Write(key, value)); | ||||
} | } | ||||
} | } | ||||
for (int seek_start : {0x00, 0x80}) { | for (const int seek_start : {0x00, 0x80}) { | ||||
it->Seek((uint8_t)seek_start); | it->Seek((uint8_t)seek_start); | ||||
for (unsigned int x = seek_start; x < 255; ++x) { | for (unsigned int x = seek_start; x < 255; ++x) { | ||||
uint8_t key; | uint8_t key; | ||||
uint32_t value; | uint32_t value; | ||||
BOOST_CHECK(it->Valid()); | BOOST_CHECK(it->Valid()); | ||||
// Avoid spurious errors about invalid iterator's key and value in | // Avoid spurious errors about invalid iterator's key and value in | ||||
// case of failure | // case of failure | ||||
if (!it->Valid()) break; | if (!it->Valid()) break; | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |