forked from organicmaps/organicmaps
[search] Add test which demonstrates bad LocalityScorer results.
This commit is contained in:
parent
4ee89ed51c
commit
91fe72db9c
1 changed files with 32 additions and 0 deletions
|
@ -2827,5 +2827,37 @@ UNIT_CLASS_TEST(ProcessorTest, AvoidMatchAroundPivotInMwmWithCity)
|
|||
TEST(ResultsMatch("Minsk cafe", rules), ());
|
||||
}
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(ProcessorTest, LocalityScorer)
|
||||
{
|
||||
TestCity sp0(m2::PointD(0.0, 0.0), "San Pedro", "en", 50 /* rank */);
|
||||
TestCity sp1(m2::PointD(1.0, 1.0), "San Pedro", "en", 50 /* rank */);
|
||||
TestCity sp2(m2::PointD(2.0, 2.0), "San Pedro", "en", 50 /* rank */);
|
||||
TestCity sp3(m2::PointD(3.0, 3.0), "San Pedro", "en", 50 /* rank */);
|
||||
TestCity sp4(m2::PointD(4.0, 4.0), "San Pedro", "en", 50 /* rank */);
|
||||
TestCity sp_good(m2::PointD(6.0, 6.0), "San Pedro de Atacama", "en", 100 /* rank */);
|
||||
|
||||
auto worldId = BuildWorld([&](TestMwmBuilder & builder) {
|
||||
builder.Add(sp0);
|
||||
builder.Add(sp1);
|
||||
builder.Add(sp2);
|
||||
builder.Add(sp3);
|
||||
builder.Add(sp4);
|
||||
builder.Add(sp_good);
|
||||
});
|
||||
|
||||
SetViewport(m2::RectD(m2::PointD(5.0, 5.0), m2::PointD(7.0, 7.0)));
|
||||
{
|
||||
// No results because GetToLocalities leaves sp0..sp4 even if |sp_good| has bigger rank and
|
||||
// is closer to viewort center.
|
||||
// sp0..sp4 are not in final results because there is no relaxed results for cities with multiple unmatched tokens.
|
||||
Rules rules = {};
|
||||
TEST(ResultsMatch("San Pedro de Atacama ", rules), ());
|
||||
}
|
||||
{
|
||||
Rules rules = {ExactMatch(worldId, sp_good)};
|
||||
TEST(ResultsMatch("Atacama ", rules), ());
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace search
|
||||
|
|
Loading…
Add table
Reference in a new issue