diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index 6d864d3ae9..8df472e569 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -72,6 +72,26 @@ private: int const m_priceRate; }; +class TestCafeWithCuisine : public TestCafe +{ +public: + TestCafeWithCuisine(m2::PointD const & center, string const & name, string const & lang, string const & cuisine) + : TestCafe(center, name, lang), m_cuisine(cuisine) + { + } + + // TestPOI overrides: + void Serialize(FeatureBuilder1 & fb) const override + { + TestCafe::Serialize(fb); + + auto & metadata = fb.GetMetadataForTesting(); + metadata.Set(feature::Metadata::FMD_CUISINE, m_cuisine); + } + +private: + string m_cuisine; +}; class ProcessorTest : public SearchTest { }; @@ -1426,5 +1446,59 @@ UNIT_CLASS_TEST(ProcessorTest, SelectProperName) testLanguage("es", "Russian"); testLanguage("de", "Russian"); } + +UNIT_CLASS_TEST(ProcessorTest, CuisineTest) +{ + string const countryName = "Wonderland"; + + TestPOI vegan(m2::PointD(1.0, 1.0), "Useless name", "en"); + vegan.SetTypes({{"amenity", "cafe"}, {"cuisine", "vegan"}}); + + TestPOI pizza(m2::PointD(1.0, 1.0), "Useless name", "en"); + pizza.SetTypes({{"amenity", "bar"}, {"cuisine", "pizza"}}); + + auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { + builder.Add(vegan); + builder.Add(pizza); + }); + + SetViewport(m2::RectD(-1, -1, 1, 1)); + + { + TRules rules{ExactMatch(countryId, vegan)}; + TEST(ResultsMatch("vegan ", "en", rules), ()); + } + + { + TRules rules{ExactMatch(countryId, pizza)}; + TEST(ResultsMatch("pizza ", "en", rules), ()); + TEST(ResultsMatch("pizzeria ", "en", rules), ()); + } +} + +UNIT_CLASS_TEST(ProcessorTest, CuisineMetadataTest) +{ + string const countryName = "Wonderland"; + + TestCafeWithCuisine kebab(m2::PointD(1.0, 1.0), "Useless name", "en", "kebab"); + TestCafeWithCuisine tapas(m2::PointD(1.0, 1.0), "Useless name", "en", "tapas"); + + auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { + builder.Add(kebab); + builder.Add(tapas); + }); + + SetViewport(m2::RectD(-1, -1, 1, 1)); + + { + TRules rules{ExactMatch(countryId, kebab)}; + TEST(ResultsMatch("kebab ", "en", rules), ()); + } + + { + TRules rules{ExactMatch(countryId, tapas)}; + TEST(ResultsMatch("tapas ", "en", rules), ()); + } +} } // namespace } // namespace search