@@ -24,8 +24,7 @@ BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup)
24
24
BOOST_AUTO_TEST_CASE(dbwrapper)
25
25
{
26
26
// Perform tests both obfuscated and non-obfuscated.
27
- for (int i = 0 ; i < 2 ; i++) {
28
- bool obfuscate = (bool )i;
27
+ for (bool obfuscate : {false , true }) {
29
28
fs::path ph = fs::temp_directory_path () / fs::unique_path ();
30
29
CDBWrapper dbw (ph, (1 << 20 ), true , false , obfuscate);
31
30
char key = ' k' ;
@@ -45,8 +44,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper)
45
44
BOOST_AUTO_TEST_CASE (dbwrapper_batch)
46
45
{
47
46
// Perform tests both obfuscated and non-obfuscated.
48
- for (int i = 0 ; i < 2 ; i++) {
49
- bool obfuscate = (bool )i;
47
+ for (bool obfuscate : {false , true }) {
50
48
fs::path ph = fs::temp_directory_path () / fs::unique_path ();
51
49
CDBWrapper dbw (ph, (1 << 20 ), true , false , obfuscate);
52
50
@@ -82,8 +80,7 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch)
82
80
BOOST_AUTO_TEST_CASE (dbwrapper_iterator)
83
81
{
84
82
// Perform tests both obfuscated and non-obfuscated.
85
- for (int i = 0 ; i < 2 ; i++) {
86
- bool obfuscate = (bool )i;
83
+ for (bool obfuscate : {false , true }) {
87
84
fs::path ph = fs::temp_directory_path () / fs::unique_path ();
88
85
CDBWrapper dbw (ph, (1 << 20 ), true , false , obfuscate);
89
86
@@ -211,12 +208,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
211
208
}
212
209
213
210
std::unique_ptr<CDBIterator> it (const_cast <CDBWrapper&>(dbw).NewIterator ());
214
- for (int c=0 ; c<2 ; ++c) {
215
- int seek_start;
216
- if (c == 0 )
217
- seek_start = 0x00 ;
218
- else
219
- seek_start = 0x80 ;
211
+ for (int seek_start : {0x00 , 0x80 }) {
220
212
it->Seek ((uint8_t )seek_start);
221
213
for (int x=seek_start; x<256 ; ++x) {
222
214
uint8_t key;
@@ -287,12 +279,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
287
279
}
288
280
289
281
std::unique_ptr<CDBIterator> it (const_cast <CDBWrapper&>(dbw).NewIterator ());
290
- for (int c=0 ; c<2 ; ++c) {
291
- int seek_start;
292
- if (c == 0 )
293
- seek_start = 0 ;
294
- else
295
- seek_start = 5 ;
282
+ for (int seek_start : {0 , 5 }) {
296
283
snprintf (buf, sizeof (buf), " %d" , seek_start);
297
284
StringContentsSerializer seek_key (buf);
298
285
it->Seek (seek_key);
0 commit comments