From fee868eb36e2573a7665e36c4acd783ebc8d5803 Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Thu, 23 Jul 2015 18:55:49 +0300 Subject: [PATCH] Review fixes. --- platform/local_country_file.hpp | 2 -- search/feature_offset_match.hpp | 2 +- search/integration_tests/smoke_test.cpp | 27 ++++++++++++------- .../integration_tests/test_search_request.hpp | 4 +++ 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/platform/local_country_file.hpp b/platform/local_country_file.hpp index 46ec1a4e1f..ae556910d2 100644 --- a/platform/local_country_file.hpp +++ b/platform/local_country_file.hpp @@ -21,8 +21,6 @@ public: // SyncWithDisk() is called. LocalCountryFile(string const & directory, CountryFile const & countryFile, int64_t version); - virtual ~LocalCountryFile() = default; - // Syncs internal state like availability of map and routing files, // their sizes etc. with disk. void SyncWithDisk(); diff --git a/search/feature_offset_match.hpp b/search/feature_offset_match.hpp index 7d68a8e40a..529a258f24 100644 --- a/search/feature_offset_match.hpp +++ b/search/feature_offset_match.hpp @@ -111,7 +111,7 @@ void FullMatchInTrie(TrieIterator const & trieRoot, unique_ptr const pIter( MoveTrieIteratorToString(trieRoot, s, symbolsMatched, bFullEdgeMatched)); - if (!pIter || (s.size() != 0 && !bFullEdgeMatched) || symbolsMatched != s.size()) + if (!pIter || (!s.empty() && !bFullEdgeMatched) || symbolsMatched != s.size()) return; #if defined(OMIM_OS_IPHONE) && !defined(__clang__) diff --git a/search/integration_tests/smoke_test.cpp b/search/integration_tests/smoke_test.cpp index e9b28b9331..6cbcae2739 100644 --- a/search/integration_tests/smoke_test.cpp +++ b/search/integration_tests/smoke_test.cpp @@ -15,20 +15,25 @@ namespace { -class ScopedMapFile : public platform::LocalCountryFile +class ScopedMapFile { public: - ScopedMapFile(string const & name) - : platform::LocalCountryFile(GetPlatform().TmpDir(), platform::CountryFile(name), 0) + explicit ScopedMapFile(string const & name) + : m_file(GetPlatform().TmpDir(), platform::CountryFile(name), 0) { - platform::CountryIndexes::DeleteFromDisk(*this); + platform::CountryIndexes::DeleteFromDisk(m_file); } - ~ScopedMapFile() override + ~ScopedMapFile() { - platform::CountryIndexes::DeleteFromDisk(*this); - DeleteFromDisk(TMapOptions::EMap); + platform::CountryIndexes::DeleteFromDisk(m_file); + m_file.DeleteFromDisk(TMapOptions::EMap); } + + inline platform::LocalCountryFile & GetFile() { return m_file; } + +private: + platform::LocalCountryFile m_file; }; } // namespace @@ -47,7 +52,9 @@ void TestFeaturesCount(TestSearchEngine const & engine, m2::RectD const & rect, UNIT_TEST(GenerateTestMwm_Smoke) { classificator::Load(); - ScopedMapFile file("BuzzTown"); + ScopedMapFile scopedFile("BuzzTown"); + platform::LocalCountryFile & file = scopedFile.GetFile(); + { TestMwmBuilder builder(file); builder.AddPOI(m2::PointD(0, 0), "Wine shop", "en"); @@ -83,7 +90,9 @@ UNIT_TEST(GenerateTestMwm_Smoke) UNIT_TEST(GenerateTestMwm_NotPrefixFreeNames) { classificator::Load(); - ScopedMapFile file("ATown"); + ScopedMapFile scopedFile("ATown"); + platform::LocalCountryFile & file = scopedFile.GetFile(); + { TestMwmBuilder builder(file); builder.AddPOI(m2::PointD(0, 0), "a", "en"); diff --git a/search/integration_tests/test_search_request.hpp b/search/integration_tests/test_search_request.hpp index 90dca14c43..fc36b578de 100644 --- a/search/integration_tests/test_search_request.hpp +++ b/search/integration_tests/test_search_request.hpp @@ -11,6 +11,10 @@ class TestSearchEngine; +// This class wraps a search query to a search engine. Note that a +// full token match will be performed, e.g. the last token will be +// handled as a complete token (like other tokens), not a token's +// prefix. class TestSearchRequest { public: