diff options
author | mpimenov <mpimenov@users.noreply.github.com> | 2016-08-23 12:09:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 12:09:42 +0300 |
commit | 135a12cd030a8bf0c62caaae621bc625a8ff1be1 (patch) | |
tree | 5172a3cc90a8a259824bf23d7b08e67d2db06684 /search/search_integration_tests | |
parent | 8936e7c5dec8aa9b68e5ace346d65ce245c3a81c (diff) | |
parent | c94745676714ee4744161b2db5e27cfed213907c (diff) |
Merge pull request #4101 from ygorshenin/clustering
[search] Implemented viewport search results filtering.
Diffstat (limited to 'search/search_integration_tests')
-rw-r--r-- | search/search_integration_tests/pre_ranker_test.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/search/search_integration_tests/pre_ranker_test.cpp b/search/search_integration_tests/pre_ranker_test.cpp index 50eb2f5502..d97c79758f 100644 --- a/search/search_integration_tests/pre_ranker_test.cpp +++ b/search/search_integration_tests/pre_ranker_test.cpp @@ -39,17 +39,6 @@ namespace search { namespace { -// Returns the boundary such that at least |size| elements from -// |distance| are less than or equal to the boundary. -double GetBoundary(vector<double> const & distances, size_t size) -{ - CHECK_LESS_OR_EQUAL(size, distances.size(), ()); - my::limited_priority_queue<double> queue(size); - for (auto const & distance : distances) - queue.push(distance); - return queue.empty() ? 0.0 : queue.top(); -} - class TestRanker : public Ranker { public: @@ -96,7 +85,9 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) // number of results is larger than batch size, and that PreRanker // emits results nearest to the pivot. - m2::PointD const kPivot(0.5, 0.5); + m2::PointD const kPivot(0, 0); + m2::RectD const kViewport(m2::PointD(-5, -5), m2::PointD(5, 5)); + size_t const kBatchSize = 50; vector<TestPOI> pois; @@ -122,6 +113,7 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) PreRanker preRanker(m_engine, ranker, pois.size()); PreRanker::Params params; + params.m_viewport = kViewport; params.m_accuratePivotCenter = kPivot; params.m_scale = scales::GetUpperScale(); params.m_batchSize = kBatchSize; @@ -152,8 +144,6 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) TEST(ranker.Finished(), ()); TEST_EQUAL(results.size(), kBatchSize, ()); - double const boundary = GetBoundary(distances, kBatchSize); - vector<bool> checked(pois.size()); for (size_t i = 0; i < results.size(); ++i) { @@ -161,7 +151,6 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) TEST_LESS(index, pois.size(), ()); TEST(!checked[index], (index)); - TEST_LESS_OR_EQUAL(results[i].GetDistance(), boundary, ()); TEST(my::AlmostEqualAbs(distances[index], results[i].GetDistance(), 1e-3), (distances[index], results[i].GetDistance())); checked[index] = true; |