| 69 | static_assert(ARRAY_SIZE(kDX) == ARRAY_SIZE(kDY), "Wrong deltas lists"); |
| 70 | |
| 71 | UNIT_CLASS_TEST(InteractiveSearchTest, Smoke) |
| 72 | { |
| 73 | m2::PointD const cafesPivot(-1, -1); |
| 74 | m2::PointD const hotelsPivot(1, 1); |
| 75 | |
| 76 | vector<TestCafe> cafes; |
| 77 | for (size_t i = 0; i < ARRAY_SIZE(kDX); ++i) |
| 78 | cafes.emplace_back(m2::Shift(cafesPivot, kDX[i], kDY[i])); |
| 79 | |
| 80 | vector<TestHotel> hotels; |
| 81 | for (size_t i = 0; i < ARRAY_SIZE(kDX); ++i) |
| 82 | hotels.emplace_back(m2::Shift(hotelsPivot, kDX[i], kDY[i])); |
| 83 | |
| 84 | auto const id = BuildCountry("Wonderland", [&](TestMwmBuilder & builder) |
| 85 | { |
| 86 | for (auto const & cafe : cafes) |
| 87 | builder.Add(cafe); |
| 88 | for (auto const & hotel : hotels) |
| 89 | builder.Add(hotel); |
| 90 | }); |
| 91 | |
| 92 | { |
| 93 | Stats stats; |
| 94 | InteractiveSearchRequest request(m_engine, "cafe", m2::RectD(m2::PointD(-1.5, -1.5), m2::PointD(-0.5, -0.5)), |
| 95 | stats); |
| 96 | request.Run(); |
| 97 | |
| 98 | Rules const rules = {ExactMatch(id, cafes[0]), ExactMatch(id, cafes[1]), ExactMatch(id, cafes[2]), |
| 99 | ExactMatch(id, cafes[3])}; |
| 100 | |
| 101 | TEST_EQUAL(stats.m_numShownResults, 4, ()); |
| 102 | TEST(MatchResults(m_dataSource, rules, request.Results()), ()); |
| 103 | } |
| 104 | |
| 105 | { |
| 106 | Stats stats; |
| 107 | InteractiveSearchRequest request(m_engine, "hotel", m2::RectD(m2::PointD(0.5, 0.5), m2::PointD(1.5, 1.5)), stats); |
| 108 | request.Run(); |
| 109 | |
| 110 | Rules const rules = {ExactMatch(id, hotels[0]), ExactMatch(id, hotels[1]), ExactMatch(id, hotels[2]), |
| 111 | ExactMatch(id, hotels[3])}; |
| 112 | |
| 113 | TEST_EQUAL(stats.m_numShownResults, 4, ()); |
| 114 | TEST(MatchResults(m_dataSource, rules, request.Results()), ()); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | UNIT_CLASS_TEST(InteractiveSearchTest, NearbyFeaturesInViewport) |
| 119 | { |
nothing calls this directly
no test coverage detected