From 8e3e89d9626a36d456b8c175fa87e9c0047466ee Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Sun, 26 Jun 2022 16:47:12 +0300 Subject: [PATCH] [categories] Declare @post category before usage. Signed-off-by: Viktor Govako --- data/categories.txt | 80 +++++++++---------- .../search_integration_tests/utils_test.cpp | 16 ++-- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/data/categories.txt b/data/categories.txt index 77aa506e1e..b48146f364 100644 --- a/data/categories.txt +++ b/data/categories.txt @@ -4071,6 +4071,45 @@ zh-Hant:成藥 el:φαρμακείο|φαρμακοποιός|χορήγηση φαρμάκων fa:داروخانه +# First keyword should match [post] definition in strings.txt! +@post +en:3Post +ru:3Почта +be:3Пошта +bg:3Поща|пощенска кутия +ar:بريد +cs:3Pošta +da:3Post +nl:3Post +fi:3Posti +fr:3Poste +de:3Post +hu:3Posta +id:Pos +it:3Posta +ja:1郵便局 +ko:1우편 +mr:टपाल|पोस्ट +nb:3Post +pl:4Poczta +pt:3Correios +pt-BR:3Correios +ro:3Poştă +es:4Oficina de correos +eu:Posta bulegoa +sv:3Post +th:3ไปรษณีย์ +tr:3Posta +uk:3Пошта +vi:Bưu điện +zh-Hans:1邮政 +zh-Hant:1郵局 +el:Ταχυδρομείο +he:דואר +sk:3Pošta +sw:3Posta +fa:پست + amenity-post_box|@post en:3Post Box|Postbox|4Mailbox|Drop Box|U+2709|U+1F4E8|U+1F4E9|U+1F4EA|U+1F4EB|U+1F4EE|U+1F4EC|U+1F4ED ru:3Почтовый ящик @@ -4108,45 +4147,6 @@ sk:3Poštová schránka|3schránka sw:Sanduku la posta fa:صندوق پست -# First keyword should match [post] definition in strings.txt! -@post -en:3Post -ru:3Почта -be:3Пошта -bg:3Поща|пощенска кутия -ar:بريد -cs:3Pošta -da:3Post -nl:3Post -fi:3Posti -fr:3Poste -de:3Post -hu:3Posta -id:Pos -it:3Posta -ja:1郵便局 -ko:1우편 -mr:टपाल|पोस्ट -nb:3Post -pl:4Poczta -pt:3Correios -pt-BR:3Correios -ro:3Poştă -es:Oficina de correos -eu:Posta bulegoa -sv:3Post -th:3ไปรษณีย์ -tr:3Posta -uk:3Пошта -vi:Bưu điện -zh-Hans:1邮政 -zh-Hant:1郵局 -el:Ταχυδρομείο -he:דואר -sk:3Pošta -sw:3Posta -fa:پست - amenity-post_office|@post en:3Post Office|U+2709|U+1F3E3|U+1F4E8|U+1F4E9|U+1F3E4|U+1F4EF ru:3Почтовое отделение @@ -4163,7 +4163,7 @@ pl:Poczta|listy pt:Estação de correios|Posto de correios|Correios pt-BR:3Correios ro:Oficiu poștal -es:4Oficina de correos|3post +es:3post eu:4Posta bulegoa|3post sv:3Postkontor tr:3Postane diff --git a/search/search_integration_tests/utils_test.cpp b/search/search_integration_tests/utils_test.cpp index 16a5fe8cc0..ecda46f556 100644 --- a/search/search_integration_tests/utils_test.cpp +++ b/search/search_integration_tests/utils_test.cpp @@ -17,14 +17,12 @@ #include #include +namespace search_utils_test +{ using namespace generator::tests_support; -using namespace search::tests_support; +using namespace search; using namespace std; -namespace search -{ -namespace -{ class SearchUtilsTest : public SearchTest { public: @@ -52,17 +50,22 @@ UNIT_CLASS_TEST(SearchUtilsTest, Utils) }); auto const & categories = GetDefaultCategories(); + auto const typesPost = GetCategoryTypes("Oficina de correos", "es", categories); auto const typesCafe = GetCategoryTypes("Cafe", "en", categories); auto const typesRestaurant = GetCategoryTypes("Restaurant", "en", categories); auto const typesBar = GetCategoryTypes("Bar", "en", categories); auto const typesFood = GetCategoryTypes("Eat", "en", categories); // GetCategoryTypes must return sorted vector of types. + TEST(is_sorted(typesPost.begin(), typesPost.end()), ()); TEST(is_sorted(typesCafe.begin(), typesCafe.end()), ()); TEST(is_sorted(typesRestaurant.begin(), typesRestaurant.end()), ()); TEST(is_sorted(typesBar.begin(), typesBar.end()), ()); TEST(is_sorted(typesFood.begin(), typesFood.end()), ()); + for (char const * s : {"post_office", "post_box", "parcel_locker"}) + TEST(binary_search(typesPost.begin(), typesPost.end(), classif().GetTypeByPath({"amenity", s})), (s)); + // Now "Cafe" and "Restaurant" are synonyms in categories. TEST_EQUAL(typesCafe, typesRestaurant, ()); TEST_NOT_EQUAL(typesCafe, typesBar, ()); @@ -111,5 +114,4 @@ UNIT_TEST(IsCategorialRequestFuzzy) TEST(!isHotelRequest("where to stay"), ()); TEST(!isHotelRequest("random request"), ()); } -} // namespace -} // namespace search +} // namespace search_utils_test