[categories] Declare @post category before usage.

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako 2022-06-26 16:47:12 +03:00
parent 26c4c39467
commit 8e3e89d962
2 changed files with 49 additions and 47 deletions

View file

@ -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

View file

@ -17,14 +17,12 @@
#include <string>
#include <vector>
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