From 733ef473e03b1e4e3bdf37d7616b0cf6488cac57 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Wed, 31 Jan 2024 16:16:35 -0300 Subject: [PATCH] [generator] Updated 'AttractionsChecker'. Signed-off-by: Viktor Govako --- indexer/ftypes_matcher.cpp | 18 +++++++++--------- indexer/indexer_tests/checker_test.cpp | 19 ++++++++++++------- indexer/indexer_tests/trie_test.cpp | 7 ++++--- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index 13738cb2be..411473c3a4 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -496,22 +496,27 @@ AttractionsChecker::AttractionsChecker() : BaseChecker(2 /* level */) {"historic", "archaeological_site"}, {"historic", "boundary_stone"}, {"historic", "castle"}, + {"historic", "city_gate"}, + {"historic", "citywalls"}, {"historic", "fort"}, + {"historic", "gallows"}, {"historic", "memorial"}, {"historic", "monument"}, + {"historic", "pillory"}, {"historic", "ruins"}, {"historic", "ship"}, {"historic", "tomb"}, {"historic", "wayside_cross"}, {"historic", "wayside_shrine"}, {"landuse", "cemetery"}, + {"leisure", "beach_resort"}, {"leisure", "garden"}, + {"leisure", "marina"}, {"leisure", "nature_reserve"}, {"leisure", "park"}, {"leisure", "water_park"}, {"man_made", "lighthouse"}, {"man_made", "windmill"}, - //{"man_made", "tower"}, {"natural", "beach"}, {"natural", "cave_entrance"}, {"natural", "geyser"}, @@ -520,6 +525,7 @@ AttractionsChecker::AttractionsChecker() : BaseChecker(2 /* level */) {"natural", "peak"}, {"natural", "volcano"}, {"place", "square"}, + {"tourism", "aquarium"}, {"tourism", "artwork"}, {"tourism", "museum"}, {"tourism", "gallery"}, @@ -531,10 +537,7 @@ AttractionsChecker::AttractionsChecker() : BaseChecker(2 /* level */) Classificator const & c = classif(); for (auto const & e : primaryAttractionTypes) - { - auto const type = c.GetTypeByPath(e); - m_types.push_back(type); - } + m_types.push_back(c.GetTypeByPath(e)); sort(m_types.begin(), m_types.end()); m_additionalTypesStart = m_types.size(); @@ -545,10 +548,7 @@ AttractionsChecker::AttractionsChecker() : BaseChecker(2 /* level */) }; for (auto const & e : additionalAttractionTypes) - { - auto const type = c.GetTypeByPath(e); - m_types.push_back(type); - } + m_types.push_back(c.GetTypeByPath(e)); sort(m_types.begin() + m_additionalTypesStart, m_types.end()); } diff --git a/indexer/indexer_tests/checker_test.cpp b/indexer/indexer_tests/checker_test.cpp index 1fbcbf76c6..846e3eb36a 100644 --- a/indexer/indexer_tests/checker_test.cpp +++ b/indexer/indexer_tests/checker_test.cpp @@ -1,5 +1,7 @@ #include "testing/testing.hpp" +#include "search/utils.hpp" + #include "indexer/classificator.hpp" #include "indexer/classificator_loader.hpp" #include "indexer/ftypes_matcher.hpp" @@ -150,15 +152,17 @@ UNIT_TEST(IsAttractionsChecker) Classificator const & c = classif(); auto const & checker = ftypes::AttractionsChecker::Instance(); - base::StringIL const types[] = { - {"amenity", "grave_yard"}, - {"historic", "ruins"}, - {"waterway", "waterfall"}, + auto const isTourismInfo = [ethalon = c.GetTypeByPath({"tourism", "information"})](uint32_t t) + { + ftype::TruncValue(t, 2); + return t == ethalon; }; - for (auto const & t : types) - TEST(checker(c.GetTypeByPath(t)), ()); - TEST(!checker(c.GetTypeByPath({"route", "shuttle_train"})), ()); + for (uint32_t const t : search::GetCategoryTypes("sights", "en", GetDefaultCategories())) + { + if (!isTourismInfo(t)) + TEST(checker(t), (c.GetFullObjectName(t))); + } } UNIT_TEST(IsMotorwayJunctionChecker) @@ -168,4 +172,5 @@ UNIT_TEST(IsMotorwayJunctionChecker) TEST(ftypes::IsMotorwayJunctionChecker::Instance()(GetMotorwayJunctionType()), ()); TEST(!ftypes::IsMotorwayJunctionChecker::Instance()(GetStreetTypes()), ()); } + } // namespacce checker_test diff --git a/indexer/indexer_tests/trie_test.cpp b/indexer/indexer_tests/trie_test.cpp index 32ddcb176b..0321bb541e 100644 --- a/indexer/indexer_tests/trie_test.cpp +++ b/indexer/indexer_tests/trie_test.cpp @@ -19,10 +19,10 @@ #include +namespace trie_test +{ using namespace std; -namespace -{ struct ChildNodeInfo { ChildNodeInfo(bool isLeaf, uint32_t size, char const * edge) : m_isLeaf(isLeaf), m_size(size) @@ -108,7 +108,6 @@ public: private: vector m_values; }; -} // namespace #define ZENC bits::ZigZagEncode #define MKSC(x) static_cast(x) @@ -223,3 +222,5 @@ UNIT_TEST(TrieBuilder_Build) } } } + +} // namespace trie_test