diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -23,8 +23,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper) { // Perform tests both obfuscated and non-obfuscated. - for (int i = 0; i < 2; i++) { - bool obfuscate = (bool)i; + for (bool obfuscate : {false, true}) { fs::path ph = fs::temp_directory_path() / fs::unique_path(); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); char key = 'k'; @@ -44,8 +43,7 @@ // Test batch operations BOOST_AUTO_TEST_CASE(dbwrapper_batch) { // Perform tests both obfuscated and non-obfuscated. - for (int i = 0; i < 2; i++) { - bool obfuscate = (bool)i; + for (bool obfuscate : {false, true}) { fs::path ph = fs::temp_directory_path() / fs::unique_path(); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); @@ -80,8 +78,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator) { // Perform tests both obfuscated and non-obfuscated. - for (int i = 0; i < 2; i++) { - bool obfuscate = (bool)i; + for (bool obfuscate : {false, true}) { fs::path ph = fs::temp_directory_path() / fs::unique_path(); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); @@ -208,12 +205,7 @@ std::unique_ptr it( const_cast(dbw).NewIterator()); - for (int c = 0; c < 2; ++c) { - int seek_start; - if (c == 0) - seek_start = 0x00; - else - seek_start = 0x80; + for (int seek_start : {0x00, 0x80}) { it->Seek((uint8_t)seek_start); for (int x = seek_start; x < 256; ++x) { uint8_t key; @@ -287,12 +279,7 @@ std::unique_ptr it( const_cast(dbw).NewIterator()); - for (int c = 0; c < 2; ++c) { - int seek_start; - if (c == 0) - seek_start = 0; - else - seek_start = 5; + for (int seek_start : {0, 5}) { sprintf(buf, "%d", seek_start); StringContentsSerializer seek_key(buf); it->Seek(seek_key);