@@ -81,8 +81,8 @@ class CCoinsViewCacheTest : public CCoinsViewCache
8181 // Manually recompute the dynamic usage of the whole data, and compare it.
8282 size_t ret = memusage::DynamicUsage (cacheCoins);
8383 size_t count = 0 ;
84- for (CCoinsMap::iterator it = cacheCoins. begin (); it != cacheCoins. end (); it++ ) {
85- ret += it-> second .coin .DynamicMemoryUsage ();
84+ for (const auto & entry : cacheCoins) {
85+ ret += entry. second .coin .DynamicMemoryUsage ();
8686 ++count;
8787 }
8888 BOOST_CHECK_EQUAL (GetCacheSize (), count);
@@ -189,15 +189,15 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
189189
190190 // Once every 1000 iterations and at the end, verify the full cache.
191191 if (InsecureRandRange (1000 ) == 1 || i == NUM_SIMULATION_ITERATIONS - 1 ) {
192- for (auto it = result. begin (); it != result. end (); it++ ) {
193- bool have = stack.back ()->HaveCoin (it-> first );
194- const Coin& coin = stack.back ()->AccessCoin (it-> first );
192+ for (const auto & entry : result) {
193+ bool have = stack.back ()->HaveCoin (entry. first );
194+ const Coin& coin = stack.back ()->AccessCoin (entry. first );
195195 BOOST_CHECK (have == !coin.IsSpent ());
196- BOOST_CHECK (coin == it-> second );
196+ BOOST_CHECK (coin == entry. second );
197197 if (coin.IsSpent ()) {
198198 missed_an_entry = true ;
199199 } else {
200- BOOST_CHECK (stack.back ()->HaveCoinInCache (it-> first ));
200+ BOOST_CHECK (stack.back ()->HaveCoinInCache (entry. first ));
201201 found_an_entry = true ;
202202 }
203203 }
@@ -420,11 +420,11 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
420420
421421 // Once every 1000 iterations and at the end, verify the full cache.
422422 if (InsecureRandRange (1000 ) == 1 || i == NUM_SIMULATION_ITERATIONS - 1 ) {
423- for (auto it = result. begin (); it != result. end (); it++ ) {
424- bool have = stack.back ()->HaveCoin (it-> first );
425- const Coin& coin = stack.back ()->AccessCoin (it-> first );
423+ for (const auto & entry : result) {
424+ bool have = stack.back ()->HaveCoin (entry. first );
425+ const Coin& coin = stack.back ()->AccessCoin (entry. first );
426426 BOOST_CHECK (have == !coin.IsSpent ());
427- BOOST_CHECK (coin == it-> second );
427+ BOOST_CHECK (coin == entry. second );
428428 }
429429 }
430430
0 commit comments