[search] Add countries/states synonyms search test.

This commit is contained in:
tatiana-yan 2019-02-05 13:31:37 +03:00 committed by mpimenov
parent 9384819e3d
commit 8729a31c75

View file

@ -1679,5 +1679,32 @@ UNIT_CLASS_TEST(ProcessorTest, SquareAsStreetTest)
TEST(ResultsMatch("revolution square 3", rules), ());
}
}
UNIT_CLASS_TEST(ProcessorTest, SynonymsTest)
{
TestCountry usa(m2::PointD(0.5, 0.5), "United States of America", "en");
TestPOI alabama(m2::PointD(0.5, 0.5), "Alabama", "en");
alabama.SetTypes({{"place", "state"}});
auto worldId = BuildWorld([&](TestMwmBuilder & builder)
{
builder.Add(usa);
builder.Add(alabama);
});
SetViewport(m2::RectD(m2::PointD(0.0, 0.0), m2::PointD(1.0, 1.0)));
{
TRules rules = {ExactMatch(worldId, usa)};
TEST(ResultsMatch("United States of America", rules), ());
TEST(ResultsMatch("USA", rules), ());
TEST(ResultsMatch("US", rules), ());
}
{
TRules rules = {ExactMatch(worldId, alabama)};
TEST(ResultsMatch("Alabama", rules), ());
TEST(ResultsMatch("AL", rules), ());
}
}
} // namespace
} // namespace search