From f05f48364502ac8075765abdd21199bee1f31fca Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Wed, 22 Nov 2017 16:50:07 +0300 Subject: [PATCH] Review fixes. --- map/search_api.cpp | 15 +++++++-------- .../interactive_search_test.cpp | 18 +++++++++--------- search/viewport_search_callback.cpp | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/map/search_api.cpp b/map/search_api.cpp index 65017ba64f..ac18a44337 100644 --- a/map/search_api.cpp +++ b/map/search_api.cpp @@ -309,13 +309,12 @@ void SearchAPI::UpdateSponsoredMode(std::string const & query, m_sponsoredMode = SponsoredMode::Booking; } -string DebugPrint(SearchAPI::SponsoredMode mode) { - switch (mode) { - case SearchAPI::SponsoredMode::None: - return "None"; - case SearchAPI::SponsoredMode::Cian: - return "Cian"; - case SearchAPI::SponsoredMode::Booking: - return "Booking"; +string DebugPrint(SearchAPI::SponsoredMode mode) +{ + switch (mode) + { + case SearchAPI::SponsoredMode::None: return "None"; + case SearchAPI::SponsoredMode::Cian: return "Cian"; + case SearchAPI::SponsoredMode::Booking: return "Booking"; } } diff --git a/search/search_integration_tests/interactive_search_test.cpp b/search/search_integration_tests/interactive_search_test.cpp index 9103c4ae6c..472c94b7c0 100644 --- a/search/search_integration_tests/interactive_search_test.cpp +++ b/search/search_integration_tests/interactive_search_test.cpp @@ -17,8 +17,8 @@ namespace { struct Stats { - size_t m_shownResults = 0; - bool m_mode = false; + size_t m_numShownResults = 0; + bool m_hotelDisplacementModeSet = false; }; class TestDelegate : public ViewportSearchCallback::Delegate @@ -31,16 +31,16 @@ public: // ViewportSearchCallback::Delegate overrides: void RunUITask(function fn) override { fn(); } - void SetHotelDisplacementMode() override { m_stats.m_mode = true; } + void SetHotelDisplacementMode() override { m_stats.m_hotelDisplacementModeSet = true; } bool IsViewportSearchActive() const override { return true; } void ShowViewportSearchResults(Results const & results) override { - m_stats.m_shownResults = results.GetCount(); + m_stats.m_numShownResults = results.GetCount(); } - void ClearViewportSearchResults() override { m_stats.m_shownResults = 0; } + void ClearViewportSearchResults() override { m_stats.m_numShownResults = 0; } private: Stats & m_stats; @@ -98,8 +98,8 @@ UNIT_CLASS_TEST(InteractiveSearchTest, Smoke) TRules const rules = {ExactMatch(id, cafes[0]), ExactMatch(id, cafes[1]), ExactMatch(id, cafes[2]), ExactMatch(id, cafes[3])}; - TEST(!stats.m_mode, ()); - TEST_EQUAL(stats.m_shownResults, 4, ()); + TEST(!stats.m_hotelDisplacementModeSet, ()); + TEST_EQUAL(stats.m_numShownResults, 4, ()); TEST(MatchResults(m_index, rules, request.Results()), ()); } @@ -112,8 +112,8 @@ UNIT_CLASS_TEST(InteractiveSearchTest, Smoke) TRules const rules = {ExactMatch(id, hotels[0]), ExactMatch(id, hotels[1]), ExactMatch(id, hotels[2]), ExactMatch(id, hotels[3])}; - TEST(stats.m_mode, ()); - TEST_EQUAL(stats.m_shownResults, 4, ()); + TEST(stats.m_hotelDisplacementModeSet, ()); + TEST_EQUAL(stats.m_numShownResults, 4, ()); TEST(MatchResults(m_index, rules, request.Results()), ()); } } diff --git a/search/viewport_search_callback.cpp b/search/viewport_search_callback.cpp index 72437831e6..08ce4e7c3c 100644 --- a/search/viewport_search_callback.cpp +++ b/search/viewport_search_callback.cpp @@ -34,7 +34,7 @@ void ViewportSearchCallback::operator()(Results const & results) // // We don't need to clear old results or show current results if the // search is cancelled, because: - + // // * current request is cancelled because of the next // search-in-viewport request - in this case it is the // responsibility of the next search request to clean up old results