Use range based for loop

Instead of iterating over 0 .. 1 and then deciding on an actual desired
value, use a range based for loop for the desired value.

Adapted from d0413c670b4e5dc79d5cc1bc35571fca745c9a24
Authored-by: René Nyffenegger <mail@renenyffenegger.ch>
This commit is contained in:
Simon 2018-04-04 09:57:29 -07:00
parent 923f2579b1
commit 2742b20833
1 changed files with 2 additions and 12 deletions

View File

@ -128,12 +128,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
}
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&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;
@ -204,12 +199,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
}
boost::scoped_ptr<CDBIterator> it(const_cast<CDBWrapper*>(&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}) {
snprintf(buf, sizeof(buf), "%d", seek_start);
StringContentsSerializer seek_key(buf);
it->Seek(seek_key);