Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2019-05-23 11:41:02 +0300
committermpimenov <mpimenov@users.noreply.github.com>2019-05-23 12:46:03 +0300
commitecf57a9bd342638d861402990b0240909a2a14f2 (patch)
tree444a4b555be99bb66bc0acac7f75c51027cba440 /storage
parentb6c4a590217390ec2c294c026a18c000c1d593ae (diff)
[storage] Fix CountryTree_Smoke test
Diffstat (limited to 'storage')
-rw-r--r--storage/storage_tests/simple_tree_test.cpp30
1 files changed, 10 insertions, 20 deletions
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 <class Node>
-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<Tree> 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<Tree> c2;
- tree.ForEachDescendant(c2);
- TEST_EQUAL(c2.count, 8, ());
+ count = 0;
+ tree.ForEachDescendant(countCallback);
+ TEST_EQUAL(count, 8, ());
- Calculator<Tree> 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, ());
}