diff --git a/storage/storage_tests/simple_tree_test.cpp b/storage/storage_tests/simple_tree_test.cpp index e47ad8c4b1..eb75243847 100644 --- a/storage/storage_tests/simple_tree_test.cpp +++ b/storage/storage_tests/simple_tree_test.cpp @@ -2,17 +2,6 @@ #include "storage/country_tree.hpp" -namespace -{ -template -struct Calculator -{ - size_t count; - Calculator() : count(0) {} - void operator()(Node const &) { ++count; } -}; -} // namespace - UNIT_TEST(CountryTree_Smoke) { using Tree = storage::CountryTree::Node; @@ -45,15 +34,16 @@ UNIT_TEST(CountryTree_Smoke) TEST_EQUAL(tree.Child(4).Child(0).Parent().Value().Name(), "1", ()); TEST_EQUAL(tree.Child(4).Child(2).Parent().Value().Name(), "1", ()); - Calculator c1; - tree.ForEachChild(c1); - TEST_EQUAL(c1.count, 5, ()); + size_t count = 0; + auto countCallback = [&count](Tree const &) { ++count; }; + tree.ForEachChild(countCallback); + TEST_EQUAL(count, 5, ()); - Calculator c2; - tree.ForEachDescendant(c2); - TEST_EQUAL(c2.count, 8, ()); + count = 0; + tree.ForEachDescendant(countCallback); + TEST_EQUAL(count, 8, ()); - Calculator c3; - tree.Child(4).Child(0).ForEachAncestorExceptForTheRoot(c3); - TEST_EQUAL(c3.count, 1, ()); + count = 0; + tree.Child(4).Child(0).ForEachAncestorExceptForTheRoot(countCallback); + TEST_EQUAL(count, 1, ()); }