diff options
author | Yuri Gorshenin <y@maps.me> | 2015-07-27 13:25:24 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:57:40 +0300 |
commit | 04142e39cffd676d234f2a3b39de774500c6a66e (patch) | |
tree | 4cc8006430e0a9f2b31a472d6f338ad2dcb43174 /storage | |
parent | acb80ad11be5e7431cf31fac57bbe104886e3ef6 (diff) |
Removed T-letter from TMapOptions.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/country.cpp | 6 | ||||
-rw-r--r-- | storage/country.hpp | 2 | ||||
-rw-r--r-- | storage/queued_country.cpp | 18 | ||||
-rw-r--r-- | storage/queued_country.hpp | 18 | ||||
-rw-r--r-- | storage/storage.cpp | 80 | ||||
-rw-r--r-- | storage/storage.hpp | 24 | ||||
-rw-r--r-- | storage/storage_tests/queued_country_tests.cpp | 108 | ||||
-rw-r--r-- | storage/storage_tests/storage_tests.cpp | 118 |
8 files changed, 187 insertions, 187 deletions
diff --git a/storage/country.cpp b/storage/country.cpp index f9094f023b..9cf2fee815 100644 --- a/storage/country.cpp +++ b/storage/country.cpp @@ -10,7 +10,7 @@ using platform::CountryFile; namespace storage { -uint64_t Country::Size(TMapOptions opt) const +uint64_t Country::Size(MapOptions opt) const { uint64_t size = 0; for (CountryFile const & file : m_files) @@ -211,9 +211,9 @@ void SaveImpl(T const & v, json_t * jParent) string const & strFile = file.GetNameWithoutExt(); if (strFile != strName) json_object_set_new(jCountry.get(), "f", json_string(strFile.c_str())); - json_object_set_new(jCountry.get(), "s", json_integer(file.GetRemoteSize(TMapOptions::Map))); + json_object_set_new(jCountry.get(), "s", json_integer(file.GetRemoteSize(MapOptions::Map))); json_object_set_new(jCountry.get(), "rs", - json_integer(file.GetRemoteSize(TMapOptions::CarRouting))); + json_integer(file.GetRemoteSize(MapOptions::CarRouting))); } if (v[i].SiblingsCount()) diff --git a/storage/country.hpp b/storage/country.hpp index a51997be9d..fd22df70bd 100644 --- a/storage/country.hpp +++ b/storage/country.hpp @@ -56,7 +56,7 @@ public: string const & Name() const { return m_name; } string const & Flag() const { return m_flag; } - uint64_t Size(TMapOptions opt) const; + uint64_t Size(MapOptions opt) const; }; typedef SimpleTree<Country> CountriesContainerT; diff --git a/storage/queued_country.cpp b/storage/queued_country.cpp index 38210de001..cdc3d46563 100644 --- a/storage/queued_country.cpp +++ b/storage/queued_country.cpp @@ -4,17 +4,17 @@ namespace storage { -QueuedCountry::QueuedCountry(TIndex const & index, TMapOptions opt) - : m_index(index), m_init(opt), m_left(opt), m_current(TMapOptions::Nothing) +QueuedCountry::QueuedCountry(TIndex const & index, MapOptions opt) + : m_index(index), m_init(opt), m_left(opt), m_current(MapOptions::Nothing) { ASSERT(GetIndex().IsValid(), ("Only valid countries may be downloaded.")); - ASSERT(m_left != TMapOptions::Nothing, ("Empty file set was requested for downloading.")); + ASSERT(m_left != MapOptions::Nothing, ("Empty file set was requested for downloading.")); SwitchToNextFile(); } -void QueuedCountry::AddOptions(TMapOptions opt) +void QueuedCountry::AddOptions(MapOptions opt) { - for (TMapOptions file : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions file : {MapOptions::Map, MapOptions::CarRouting}) { if (HasOptions(opt, file) && !HasOptions(m_init, file)) { @@ -24,9 +24,9 @@ void QueuedCountry::AddOptions(TMapOptions opt) } } -void QueuedCountry::RemoveOptions(TMapOptions opt) +void QueuedCountry::RemoveOptions(MapOptions opt) { - for (TMapOptions file : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions file : {MapOptions::Map, MapOptions::CarRouting}) { if (HasOptions(opt, file) && HasOptions(m_init, file)) { @@ -40,13 +40,13 @@ void QueuedCountry::RemoveOptions(TMapOptions opt) bool QueuedCountry::SwitchToNextFile() { - // static_casts are needed here because TMapOptions values are + // static_casts are needed here because MapOptions values are // actually enum flags (see 3party/enum_flags.hpp) and bitwise // operators are overloaded for them. ASSERT(HasOptions(m_left, m_current), ("Current file (", m_current, ") is not specified in left files (", m_left, ").")); m_left = UnsetOptions(m_left, m_current); m_current = LeastSignificantOption(m_left); - return m_current != TMapOptions::Nothing; + return m_current != MapOptions::Nothing; } } // namespace storage diff --git a/storage/queued_country.hpp b/storage/queued_country.hpp index de0f070273..1a74cd9133 100644 --- a/storage/queued_country.hpp +++ b/storage/queued_country.hpp @@ -9,23 +9,23 @@ namespace storage class QueuedCountry { public: - QueuedCountry(TIndex const & index, TMapOptions opt); + QueuedCountry(TIndex const & index, MapOptions opt); - void AddOptions(TMapOptions opt); - void RemoveOptions(TMapOptions opt); + void AddOptions(MapOptions opt); + void RemoveOptions(MapOptions opt); bool SwitchToNextFile(); inline TIndex const & GetIndex() const { return m_index; } - inline TMapOptions GetInitOptions() const { return m_init; } - inline TMapOptions GetCurrentFile() const { return m_current; } - inline TMapOptions GetDownloadedFiles() const { return UnsetOptions(m_init, m_left); } + inline MapOptions GetInitOptions() const { return m_init; } + inline MapOptions GetCurrentFile() const { return m_current; } + inline MapOptions GetDownloadedFiles() const { return UnsetOptions(m_init, m_left); } inline bool operator==(TIndex const & index) const { return m_index == index; } private: TIndex m_index; - TMapOptions m_init; - TMapOptions m_left; - TMapOptions m_current; + MapOptions m_init; + MapOptions m_left; + MapOptions m_current; }; } // namespace storage diff --git a/storage/storage.cpp b/storage/storage.cpp index 2fbf50d73a..d120a5743d 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -37,12 +37,12 @@ void RemoveIf(vector<T> & v, function<bool(T const & t)> const & p) v.erase(remove_if(v.begin(), v.end(), p), v.end()); } -uint64_t GetLocalSize(shared_ptr<LocalCountryFile> file, TMapOptions opt) +uint64_t GetLocalSize(shared_ptr<LocalCountryFile> file, MapOptions opt) { if (!file) return 0; uint64_t size = 0; - for (TMapOptions bit : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions bit : {MapOptions::Map, MapOptions::CarRouting}) { if (HasOptions(opt, bit)) size += file->GetSize(bit); @@ -50,10 +50,10 @@ uint64_t GetLocalSize(shared_ptr<LocalCountryFile> file, TMapOptions opt) return size; } -uint64_t GetRemoteSize(CountryFile const & file, TMapOptions opt) +uint64_t GetRemoteSize(CountryFile const & file, MapOptions opt) { uint64_t size = 0; - for (TMapOptions bit : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions bit : {MapOptions::Map, MapOptions::CarRouting}) { if (HasOptions(opt, bit)) size += file.GetRemoteSize(bit); @@ -130,7 +130,7 @@ void Storage::RegisterAllLocalMaps() LocalCountryFile & localFile = *j; LOG(LINFO, ("Removing obsolete", localFile)); localFile.SyncWithDisk(); - localFile.DeleteFromDisk(TMapOptions::MapWithCarRouting); + localFile.DeleteFromDisk(MapOptions::MapWithCarRouting); ++j; } @@ -204,7 +204,7 @@ string const & Storage::CountryFlag(TIndex const & index) const return NodeFromIndex(m_countries, index).Value().Flag(); } -LocalAndRemoteSizeT Storage::CountrySizeInBytes(TIndex const & index, TMapOptions opt) const +LocalAndRemoteSizeT Storage::CountrySizeInBytes(TIndex const & index, MapOptions opt) const { QueuedCountry const * queuedCountry = FindCountryInQueue(index); shared_ptr<LocalCountryFile> localFile = GetLatestLocalFile(index); @@ -282,25 +282,25 @@ TStatus Storage::CountryStatusEx(TIndex const & index) const return CountryStatusFull(index, CountryStatus(index)); } -void Storage::CountryStatusEx(TIndex const & index, TStatus & status, TMapOptions & options) const +void Storage::CountryStatusEx(TIndex const & index, TStatus & status, MapOptions & options) const { status = CountryStatusEx(index); if (status == TStatus::EOnDisk || status == TStatus::EOnDiskOutOfDate) { - options = TMapOptions::Map; + options = MapOptions::Map; shared_ptr<LocalCountryFile> localFile = GetLatestLocalFile(index); ASSERT(localFile, ("Invariant violation: local file out of sync with disk.")); - if (localFile->OnDisk(TMapOptions::CarRouting)) - options = SetOptions(options, TMapOptions::CarRouting); + if (localFile->OnDisk(MapOptions::CarRouting)) + options = SetOptions(options, MapOptions::CarRouting); } } -void Storage::DownloadCountry(TIndex const & index, TMapOptions opt) +void Storage::DownloadCountry(TIndex const & index, MapOptions opt) { opt = NormalizeDownloadFileSet(index, opt); - if (opt == TMapOptions::Nothing) + if (opt == MapOptions::Nothing) return; if (QueuedCountry * queuedCountry = FindCountryInQueue(index)) @@ -317,7 +317,7 @@ void Storage::DownloadCountry(TIndex const & index, TMapOptions opt) NotifyStatusChanged(index); } -void Storage::DeleteCountry(TIndex const & index, TMapOptions opt) +void Storage::DeleteCountry(TIndex const & index, MapOptions opt) { opt = NormalizeDeleteFileSet(opt); DeleteCountryFiles(index, opt); @@ -333,7 +333,7 @@ void Storage::DeleteCountry(TIndex const & index, TMapOptions opt) void Storage::DeleteCustomCountryVersion(LocalCountryFile const & localFile) { CountryFile const countryFile = localFile.GetCountryFile(); - localFile.DeleteFromDisk(TMapOptions::MapWithCarRouting); + localFile.DeleteFromDisk(MapOptions::MapWithCarRouting); { auto it = m_localFilesForFakeCountries.find(countryFile); @@ -356,7 +356,7 @@ void Storage::DeleteCustomCountryVersion(LocalCountryFile const & localFile) // If file version equals to current data version, delete from downloader all pending requests for // the country. if (localFile.GetVersion() == GetCurrentDataVersion()) - DeleteCountryFilesFromDownloader(index, TMapOptions::MapWithCarRouting); + DeleteCountryFilesFromDownloader(index, MapOptions::MapWithCarRouting); auto countryFilesIt = m_localFiles.find(index); if (countryFilesIt == m_localFiles.end()) { @@ -400,7 +400,7 @@ void Storage::DownloadNextFile(QueuedCountry const & country) bool Storage::DeleteFromDownloader(TIndex const & index) { - if (!DeleteCountryFilesFromDownloader(index, TMapOptions::MapWithCarRouting)) + if (!DeleteCountryFilesFromDownloader(index, MapOptions::MapWithCarRouting)) return false; NotifyStatusChanged(index); return true; @@ -487,7 +487,7 @@ void Storage::OnServerListDownloaded(vector<string> const & urls) QueuedCountry const & queuedCountry = m_queue.front(); TIndex const & index = queuedCountry.GetIndex(); - TMapOptions const file = queuedCountry.GetCurrentFile(); + MapOptions const file = queuedCountry.GetCurrentFile(); vector<string> fileUrls; fileUrls.reserve(urls.size()); @@ -518,7 +518,7 @@ void Storage::OnMapFileDownloadProgress(MapFilesDownloader::TProgress const & pr } } -bool Storage::RegisterDownloadedFiles(TIndex const & index, TMapOptions files) +bool Storage::RegisterDownloadedFiles(TIndex const & index, MapOptions files) { CountryFile const countryFile = GetCountryFile(index); shared_ptr<LocalCountryFile> localFile = GetLocalFile(index, GetCurrentDataVersion()); @@ -532,7 +532,7 @@ bool Storage::RegisterDownloadedFiles(TIndex const & index, TMapOptions files) } bool ok = true; - for (TMapOptions file : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions file : {MapOptions::Map, MapOptions::CarRouting}) { if (!HasOptions(files, file)) continue; @@ -553,24 +553,24 @@ bool Storage::RegisterDownloadedFiles(TIndex const & index, TMapOptions files) return true; } -void Storage::OnMapDownloadFinished(TIndex const & index, bool success, TMapOptions files) +void Storage::OnMapDownloadFinished(TIndex const & index, bool success, MapOptions files) { - ASSERT_NOT_EQUAL(TMapOptions::Nothing, files, + ASSERT_NOT_EQUAL(MapOptions::Nothing, files, ("This method should not be called for empty files set.")); { string optionsName; switch (files) { - case TMapOptions::Nothing: + case MapOptions::Nothing: optionsName = "Nothing"; break; - case TMapOptions::Map: + case MapOptions::Map: optionsName = "Map"; break; - case TMapOptions::CarRouting: + case MapOptions::CarRouting: optionsName = "CarRouting"; break; - case TMapOptions::MapWithCarRouting: + case MapOptions::MapWithCarRouting: optionsName = "MapWithCarRouting"; break; } @@ -597,7 +597,7 @@ void Storage::OnMapDownloadFinished(TIndex const & index, bool success, TMapOpti } string Storage::GetFileDownloadUrl(string const & baseUrl, TIndex const & index, - TMapOptions file) const + MapOptions file) const { CountryFile const & countryFile = GetCountryFile(index); return GetFileDownloadUrl(baseUrl, countryFile.GetNameWithExt(file)); @@ -689,11 +689,11 @@ TStatus Storage::CountryStatusFull(TIndex const & index, TStatus const status) c return status; shared_ptr<LocalCountryFile> localFile = GetLatestLocalFile(index); - if (!localFile || !localFile->OnDisk(TMapOptions::Map)) + if (!localFile || !localFile->OnDisk(MapOptions::Map)) return TStatus::ENotDownloaded; CountryFile const & countryFile = GetCountryFile(index); - if (GetRemoteSize(countryFile, TMapOptions::Map) == 0) + if (GetRemoteSize(countryFile, MapOptions::Map) == 0) return TStatus::EUnknown; if (localFile->GetVersion() != GetCurrentDataVersion()) @@ -701,14 +701,14 @@ TStatus Storage::CountryStatusFull(TIndex const & index, TStatus const status) c return TStatus::EOnDisk; } -TMapOptions Storage::NormalizeDownloadFileSet(TIndex const & index, TMapOptions opt) const +MapOptions Storage::NormalizeDownloadFileSet(TIndex const & index, MapOptions opt) const { // Car routing files are useless without map files. - if (HasOptions(opt, TMapOptions::CarRouting)) - opt = SetOptions(opt, TMapOptions::Map); + if (HasOptions(opt, MapOptions::CarRouting)) + opt = SetOptions(opt, MapOptions::Map); shared_ptr<LocalCountryFile> localCountryFile = GetLatestLocalFile(index); - for (TMapOptions file : {TMapOptions::Map, TMapOptions::CarRouting}) + for (MapOptions file : {MapOptions::Map, MapOptions::CarRouting}) { // Check whether requested files are on disk and up-to-date. if (HasOptions(opt, file) && localCountryFile && localCountryFile->OnDisk(file) && @@ -720,11 +720,11 @@ TMapOptions Storage::NormalizeDownloadFileSet(TIndex const & index, TMapOptions return opt; } -TMapOptions Storage::NormalizeDeleteFileSet(TMapOptions opt) const +MapOptions Storage::NormalizeDeleteFileSet(MapOptions opt) const { // Car routing files are useless without map files. - if (HasOptions(opt, TMapOptions::Map)) - opt = SetOptions(opt, TMapOptions::CarRouting); + if (HasOptions(opt, MapOptions::Map)) + opt = SetOptions(opt, MapOptions::CarRouting); return opt; } @@ -800,7 +800,7 @@ void Storage::RegisterFakeCountryFiles(platform::LocalCountryFile const & localF m_localFilesForFakeCountries[fakeCountryLocalFile->GetCountryFile()] = fakeCountryLocalFile; } -void Storage::DeleteCountryFiles(TIndex const & index, TMapOptions opt) +void Storage::DeleteCountryFiles(TIndex const & index, MapOptions opt) { auto const it = m_localFiles.find(index); if (it == m_localFiles.end()) @@ -812,7 +812,7 @@ void Storage::DeleteCountryFiles(TIndex const & index, TMapOptions opt) localFile->DeleteFromDisk(opt); localFile->SyncWithDisk(); DeleteCountryIndexes(*localFile); - if (localFile->GetFiles() == TMapOptions::Nothing) + if (localFile->GetFiles() == MapOptions::Nothing) localFile.reset(); } auto isNull = [](shared_ptr<LocalCountryFile> const & localFile) @@ -824,7 +824,7 @@ void Storage::DeleteCountryFiles(TIndex const & index, TMapOptions opt) m_localFiles.erase(index); } -bool Storage::DeleteCountryFilesFromDownloader(TIndex const & index, TMapOptions opt) +bool Storage::DeleteCountryFilesFromDownloader(TIndex const & index, MapOptions opt) { QueuedCountry * queuedCountry = FindCountryInQueue(index); if (!queuedCountry) @@ -842,7 +842,7 @@ bool Storage::DeleteCountryFilesFromDownloader(TIndex const & index, TMapOptions queuedCountry->RemoveOptions(opt); // Remove country from the queue if there's nothing to download. - if (queuedCountry->GetInitOptions() == TMapOptions::Nothing) + if (queuedCountry->GetInitOptions() == MapOptions::Nothing) m_queue.erase(find(m_queue.begin(), m_queue.end(), index)); if (!m_queue.empty() && m_downloader->IsIdle()) @@ -862,7 +862,7 @@ uint64_t Storage::GetDownloadSize(QueuedCountry const & queuedCountry) const return GetRemoteSize(file, queuedCountry.GetCurrentFile()); } -string Storage::GetFileDownloadPath(TIndex const & index, TMapOptions file) const +string Storage::GetFileDownloadPath(TIndex const & index, MapOptions file) const { Platform & platform = GetPlatform(); CountryFile const & countryFile = GetCountryFile(index); diff --git a/storage/storage.hpp b/storage/storage.hpp index afe69972da..60c02a4c9b 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -92,8 +92,8 @@ private: /// during the downloading process. void OnMapFileDownloadProgress(MapFilesDownloader::TProgress const & progress); - bool RegisterDownloadedFiles(TIndex const & index, TMapOptions files); - void OnMapDownloadFinished(TIndex const & index, bool success, TMapOptions files); + bool RegisterDownloadedFiles(TIndex const & index, MapOptions files); + void OnMapDownloadFinished(TIndex const & index, bool success, MapOptions files); /// Initiates downloading of the next file from the queue. void DownloadNextFile(QueuedCountry const & country); @@ -130,7 +130,7 @@ public: string const & CountryName(TIndex const & index) const; string const & CountryFlag(TIndex const & index) const; - LocalAndRemoteSizeT CountrySizeInBytes(TIndex const & index, TMapOptions opt) const; + LocalAndRemoteSizeT CountrySizeInBytes(TIndex const & index, MapOptions opt) const; platform::CountryFile const & GetCountryFile(TIndex const & index) const; shared_ptr<platform::LocalCountryFile> GetLatestLocalFile( platform::CountryFile const & countryFile) const; @@ -140,16 +140,16 @@ public: TStatus CountryStatus(TIndex const & index) const; /// Slow version, but checks if country is out of date TStatus CountryStatusEx(TIndex const & index) const; - void CountryStatusEx(TIndex const & index, TStatus & status, TMapOptions & options) const; + void CountryStatusEx(TIndex const & index, TStatus & status, MapOptions & options) const; /// Puts country denoted by index into the downloader's queue. /// During downloading process notifies observers about downloading /// progress and status changes. - void DownloadCountry(TIndex const & index, TMapOptions opt); + void DownloadCountry(TIndex const & index, MapOptions opt); /// Removes country files (for all versions) from the device. /// Notifies observers about country status change. - void DeleteCountry(TIndex const & index, TMapOptions opt); + void DeleteCountry(TIndex const & index, MapOptions opt); /// Removes country files of a particular version from the device. /// Notifies observers about country status change. @@ -165,7 +165,7 @@ public: void NotifyStatusChanged(TIndex const & index); /// get download url by index & options(first search file name by index, then format url) - string GetFileDownloadUrl(string const & baseUrl, TIndex const & index, TMapOptions file) const; + string GetFileDownloadUrl(string const & baseUrl, TIndex const & index, MapOptions file) const; /// get download url by base url & file name string GetFileDownloadUrl(string const & baseUrl, string const & fName) const; @@ -183,11 +183,11 @@ private: // Modifies file set of requested files - always adds a map file // when routing file is requested for downloading, but drops all // already downloaded and up-to-date files. - TMapOptions NormalizeDownloadFileSet(TIndex const & index, TMapOptions opt) const; + MapOptions NormalizeDownloadFileSet(TIndex const & index, MapOptions opt) const; // Modifies file set of file to deletion - always adds (marks for // removal) a routing file when map file is marked for deletion. - TMapOptions NormalizeDeleteFileSet(TMapOptions opt) const; + MapOptions NormalizeDeleteFileSet(MapOptions opt) const; // Returns a pointer to a country in the downloader's queue. QueuedCountry * FindCountryInQueue(TIndex const & index); @@ -220,10 +220,10 @@ private: void RegisterFakeCountryFiles(platform::LocalCountryFile const & localFile); // Removes disk files for all versions of a country. - void DeleteCountryFiles(TIndex const & index, TMapOptions opt); + void DeleteCountryFiles(TIndex const & index, MapOptions opt); // Removes country files from downloader. - bool DeleteCountryFilesFromDownloader(TIndex const & index, TMapOptions opt); + bool DeleteCountryFilesFromDownloader(TIndex const & index, MapOptions opt); // Returns download size of the currently downloading file for the // queued country. @@ -231,6 +231,6 @@ private: // Returns a path to a place on disk downloader can use for // downloaded files. - string GetFileDownloadPath(TIndex const & index, TMapOptions file) const; + string GetFileDownloadPath(TIndex const & index, MapOptions file) const; }; } // storage diff --git a/storage/storage_tests/queued_country_tests.cpp b/storage/storage_tests/queued_country_tests.cpp index 33d5940a90..3839399e49 100644 --- a/storage/storage_tests/queued_country_tests.cpp +++ b/storage/storage_tests/queued_country_tests.cpp @@ -9,23 +9,23 @@ UNIT_TEST(QueuedCountry_AddOptions) { Storage storage; TIndex const index = storage.FindIndexByFile("USA_Georgia"); - QueuedCountry country(index, TMapOptions::CarRouting); + QueuedCountry country(index, MapOptions::CarRouting); TEST_EQUAL(index, country.GetIndex(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); - country.AddOptions(TMapOptions::Map); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); + country.AddOptions(MapOptions::Map); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); TEST(country.SwitchToNextFile(), ()); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Map, country.GetCurrentFile(), ()); TEST(!country.SwitchToNextFile(), ()); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetCurrentFile(), ()); } UNIT_TEST(QueuedCountry_RemoveOptions) @@ -34,59 +34,59 @@ UNIT_TEST(QueuedCountry_RemoveOptions) TIndex const index = storage.FindIndexByFile("USA_Georgia"); { - QueuedCountry country(index, TMapOptions::MapWithCarRouting); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); - - country.RemoveOptions(TMapOptions::Map); - TEST_EQUAL(TMapOptions::CarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); - - country.RemoveOptions(TMapOptions::CarRouting); - TEST_EQUAL(TMapOptions::Nothing, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); + QueuedCountry country(index, MapOptions::MapWithCarRouting); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Map, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); + + country.RemoveOptions(MapOptions::Map); + TEST_EQUAL(MapOptions::CarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); + + country.RemoveOptions(MapOptions::CarRouting); + TEST_EQUAL(MapOptions::Nothing, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); } { - QueuedCountry country(index, TMapOptions::MapWithCarRouting); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); + QueuedCountry country(index, MapOptions::MapWithCarRouting); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Map, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); country.SwitchToNextFile(); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetDownloadedFiles(), ()); - - country.RemoveOptions(TMapOptions::CarRouting); - TEST_EQUAL(TMapOptions::Map, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetDownloadedFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Map, country.GetDownloadedFiles(), ()); + + country.RemoveOptions(MapOptions::CarRouting); + TEST_EQUAL(MapOptions::Map, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Map, country.GetDownloadedFiles(), ()); } { - QueuedCountry country(index, TMapOptions::MapWithCarRouting); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); + QueuedCountry country(index, MapOptions::MapWithCarRouting); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Map, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); country.SwitchToNextFile(); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetDownloadedFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Map, country.GetDownloadedFiles(), ()); - country.RemoveOptions(TMapOptions::Map); - TEST_EQUAL(TMapOptions::CarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); + country.RemoveOptions(MapOptions::Map); + TEST_EQUAL(MapOptions::CarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); country.SwitchToNextFile(); - TEST_EQUAL(TMapOptions::CarRouting, country.GetInitOptions(), ()); - TEST_EQUAL(TMapOptions::Nothing, country.GetCurrentFile(), ()); - TEST_EQUAL(TMapOptions::CarRouting, country.GetDownloadedFiles(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetInitOptions(), ()); + TEST_EQUAL(MapOptions::Nothing, country.GetCurrentFile(), ()); + TEST_EQUAL(MapOptions::CarRouting, country.GetDownloadedFiles(), ()); } } @@ -94,13 +94,13 @@ UNIT_TEST(QueuedCountry_Bits) { Storage storage; TIndex const index = storage.FindIndexByFile("USA_Georgia"); - QueuedCountry country(index, TMapOptions::MapWithCarRouting); - TEST_EQUAL(TMapOptions::Nothing, country.GetDownloadedFiles(), ()); + QueuedCountry country(index, MapOptions::MapWithCarRouting); + TEST_EQUAL(MapOptions::Nothing, country.GetDownloadedFiles(), ()); TEST(country.SwitchToNextFile(), ()); - TEST_EQUAL(TMapOptions::Map, country.GetDownloadedFiles(), ()); + TEST_EQUAL(MapOptions::Map, country.GetDownloadedFiles(), ()); TEST(!country.SwitchToNextFile(), ()); - TEST_EQUAL(TMapOptions::MapWithCarRouting, country.GetDownloadedFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, country.GetDownloadedFiles(), ()); } } // namespace storage diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp index 99806dfb82..e3be812cf0 100644 --- a/storage/storage_tests/storage_tests.cpp +++ b/storage/storage_tests/storage_tests.cpp @@ -35,7 +35,7 @@ namespace class CountryDownloaderChecker { public: - CountryDownloaderChecker(Storage & storage, TIndex const & index, TMapOptions files, + CountryDownloaderChecker(Storage & storage, TIndex const & index, MapOptions files, vector<TStatus> const & transitionList) : m_storage(storage), m_index(index), @@ -106,7 +106,7 @@ protected: Storage & m_storage; TIndex const m_index; CountryFile const m_countryFile; - TMapOptions const m_files; + MapOptions const m_files; int64_t m_bytesDownloaded; int64_t m_totalBytesToDownload; int m_slot; @@ -120,7 +120,7 @@ class CancelDownloadingWhenAlmostDoneChecker : public CountryDownloaderChecker public: CancelDownloadingWhenAlmostDoneChecker(Storage & storage, TIndex const & index, TaskRunner & runner) - : CountryDownloaderChecker(storage, index, TMapOptions::MapWithCarRouting, + : CountryDownloaderChecker(storage, index, MapOptions::MapWithCarRouting, vector<TStatus>{TStatus::ENotDownloaded, TStatus::EDownloading, TStatus::ENotDownloaded}), m_runner(runner) @@ -151,7 +151,7 @@ protected: // NotDownloaded -> Downloading -> OnDisk. unique_ptr<CountryDownloaderChecker> AbsentCountryDownloaderChecker(Storage & storage, TIndex const & index, - TMapOptions files) + MapOptions files) { return make_unique<CountryDownloaderChecker>( storage, index, files, @@ -162,7 +162,7 @@ unique_ptr<CountryDownloaderChecker> AbsentCountryDownloaderChecker(Storage & st // OnDisk -> Downloading -> OnDisk. unique_ptr<CountryDownloaderChecker> PresentCountryDownloaderChecker(Storage & storage, TIndex const & index, - TMapOptions files) + MapOptions files) { return make_unique<CountryDownloaderChecker>( storage, index, files, @@ -173,7 +173,7 @@ unique_ptr<CountryDownloaderChecker> PresentCountryDownloaderChecker(Storage & s // NotDownloaded -> InQueue -> Downloading -> OnDisk. unique_ptr<CountryDownloaderChecker> QueuedCountryDownloaderChecker(Storage & storage, TIndex const & index, - TMapOptions files) + MapOptions files) { return make_unique<CountryDownloaderChecker>( storage, index, files, vector<TStatus>{TStatus::ENotDownloaded, TStatus::EInQueue, @@ -184,7 +184,7 @@ unique_ptr<CountryDownloaderChecker> QueuedCountryDownloaderChecker(Storage & st // NotDownloaded -> Downloading -> NotDownloaded. unique_ptr<CountryDownloaderChecker> CancelledCountryDownloaderChecker(Storage & storage, TIndex const & index, - TMapOptions files) + MapOptions files) { return make_unique<CountryDownloaderChecker>( storage, index, files, @@ -204,12 +204,12 @@ shared_ptr<LocalCountryFile> CreateDummyMapFile(CountryFile const & countryFile, TEST(localFile.get(), ("Can't prepare place for", countryFile, "(version ", version, ")")); { string const zeroes(size, '\0'); - FileWriter writer(localFile->GetPath(TMapOptions::Map)); + FileWriter writer(localFile->GetPath(MapOptions::Map)); writer.Write(zeroes.data(), zeroes.size()); } localFile->SyncWithDisk(); - TEST_EQUAL(TMapOptions::Map, localFile->GetFiles(), ()); - TEST_EQUAL(size, localFile->GetSize(TMapOptions::Map), ()); + TEST_EQUAL(MapOptions::Map, localFile->GetFiles(), ()); + TEST_EQUAL(size, localFile->GetSize(MapOptions::Map), ()); return localFile; } @@ -270,13 +270,13 @@ UNIT_TEST(StorageTest_Smoke) TIndex const usaGeorgiaIndex = storage.FindIndexByFile("USA_Georgia"); TEST(usaGeorgiaIndex.IsValid(), ()); CountryFile usaGeorgiaFile = storage.GetCountryFile(usaGeorgiaIndex); - TEST_EQUAL(usaGeorgiaFile.GetNameWithExt(TMapOptions::Map), "USA_Georgia" DATA_FILE_EXTENSION, + TEST_EQUAL(usaGeorgiaFile.GetNameWithExt(MapOptions::Map), "USA_Georgia" DATA_FILE_EXTENSION, ()); TIndex const georgiaIndex = storage.FindIndexByFile("Georgia"); TEST(georgiaIndex.IsValid(), ()); CountryFile georgiaFile = storage.GetCountryFile(georgiaIndex); - TEST_EQUAL(georgiaFile.GetNameWithExt(TMapOptions::CarRouting), + TEST_EQUAL(georgiaFile.GetNameWithExt(MapOptions::CarRouting), "Georgia" DATA_FILE_EXTENSION ROUTING_FILE_EXTENSION, ()); TEST_NOT_EQUAL(usaGeorgiaIndex, georgiaIndex, ()); @@ -292,22 +292,22 @@ UNIT_TEST(StorageTest_SingleCountryDownloading) TEST(azerbaijanIndex.IsValid(), ()); CountryFile azerbaijanFile = storage.GetCountryFile(azerbaijanIndex); - storage.DeleteCountry(azerbaijanIndex, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(azerbaijanIndex, MapOptions::MapWithCarRouting); { MY_SCOPE_GUARD(cleanupCountryFiles, - bind(&Storage::DeleteCountry, &storage, azerbaijanIndex, TMapOptions::Map)); + bind(&Storage::DeleteCountry, &storage, azerbaijanIndex, MapOptions::Map)); unique_ptr<CountryDownloaderChecker> checker = - AbsentCountryDownloaderChecker(storage, azerbaijanIndex, TMapOptions::MapWithCarRouting); + AbsentCountryDownloaderChecker(storage, azerbaijanIndex, MapOptions::MapWithCarRouting); checker->StartDownload(); runner.Run(); } { MY_SCOPE_GUARD(cleanupCountryFiles, bind(&Storage::DeleteCountry, &storage, azerbaijanIndex, - TMapOptions::MapWithCarRouting)); + MapOptions::MapWithCarRouting)); unique_ptr<CountryDownloaderChecker> checker = - AbsentCountryDownloaderChecker(storage, azerbaijanIndex, TMapOptions::MapWithCarRouting); + AbsentCountryDownloaderChecker(storage, azerbaijanIndex, MapOptions::MapWithCarRouting); checker->StartDownload(); runner.Run(); } @@ -321,20 +321,20 @@ UNIT_TEST(StorageTest_TwoCountriesDownloading) TIndex const uruguayIndex = storage.FindIndexByFile("Uruguay"); TEST(uruguayIndex.IsValid(), ()); - storage.DeleteCountry(uruguayIndex, TMapOptions::Map); + storage.DeleteCountry(uruguayIndex, MapOptions::Map); MY_SCOPE_GUARD(cleanupUruguayFiles, - bind(&Storage::DeleteCountry, &storage, uruguayIndex, TMapOptions::Map)); + bind(&Storage::DeleteCountry, &storage, uruguayIndex, MapOptions::Map)); TIndex const venezuelaIndex = storage.FindIndexByFile("Venezuela"); TEST(venezuelaIndex.IsValid(), ()); - storage.DeleteCountry(venezuelaIndex, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(venezuelaIndex, MapOptions::MapWithCarRouting); MY_SCOPE_GUARD(cleanupVenezuelaFiles, bind(&Storage::DeleteCountry, &storage, venezuelaIndex, - TMapOptions::MapWithCarRouting)); + MapOptions::MapWithCarRouting)); unique_ptr<CountryDownloaderChecker> uruguayChecker = - AbsentCountryDownloaderChecker(storage, uruguayIndex, TMapOptions::Map); + AbsentCountryDownloaderChecker(storage, uruguayIndex, MapOptions::Map); unique_ptr<CountryDownloaderChecker> venezuelaChecker = - QueuedCountryDownloaderChecker(storage, venezuelaIndex, TMapOptions::MapWithCarRouting); + QueuedCountryDownloaderChecker(storage, venezuelaIndex, MapOptions::MapWithCarRouting); uruguayChecker->StartDownload(); venezuelaChecker->StartDownload(); runner.Run(); @@ -350,7 +350,7 @@ UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry) TEST(index.IsValid(), ()); CountryFile const countryFile = storage.GetCountryFile(index); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); shared_ptr<LocalCountryFile> latestLocalFile = storage.GetLatestLocalFile(index); TEST(!latestLocalFile.get(), ("Country wasn't deleted from disk.")); TEST_EQUAL(TStatus::ENotDownloaded, storage.CountryStatusEx(index), ()); @@ -371,13 +371,13 @@ UNIT_TEST(StorageTest_DeleteTwoVersionsOfTheSameCountry) TEST_EQUAL(latestLocalFile->GetVersion(), localFileV2->GetVersion(), ()); TEST_EQUAL(TStatus::EOnDiskOutOfDate, storage.CountryStatusEx(index), ()); - storage.DeleteCountry(index, TMapOptions::Map); + storage.DeleteCountry(index, MapOptions::Map); localFileV1->SyncWithDisk(); - TEST_EQUAL(TMapOptions::Nothing, localFileV1->GetFiles(), ()); + TEST_EQUAL(MapOptions::Nothing, localFileV1->GetFiles(), ()); localFileV2->SyncWithDisk(); - TEST_EQUAL(TMapOptions::Nothing, localFileV2->GetFiles(), ()); + TEST_EQUAL(MapOptions::Nothing, localFileV2->GetFiles(), ()); TEST_EQUAL(TStatus::ENotDownloaded, storage.CountryStatusEx(index), ()); } @@ -390,11 +390,11 @@ UNIT_TEST(StorageTest_DownloadCountryAndDeleteRoutingOnly) TIndex const index = storage.FindIndexByFile("Azerbaijan"); TEST(index.IsValid(), ()); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); { unique_ptr<CountryDownloaderChecker> checker = - AbsentCountryDownloaderChecker(storage, index, TMapOptions::MapWithCarRouting); + AbsentCountryDownloaderChecker(storage, index, MapOptions::MapWithCarRouting); checker->StartDownload(); runner.Run(); } @@ -402,16 +402,16 @@ UNIT_TEST(StorageTest_DownloadCountryAndDeleteRoutingOnly) // Delete routing file only and check that latest local file wasn't changed. shared_ptr<LocalCountryFile> localFileA = storage.GetLatestLocalFile(index); TEST(localFileA.get(), ()); - TEST_EQUAL(TMapOptions::MapWithCarRouting, localFileA->GetFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, localFileA->GetFiles(), ()); - storage.DeleteCountry(index, TMapOptions::CarRouting); + storage.DeleteCountry(index, MapOptions::CarRouting); shared_ptr<LocalCountryFile> localFileB = storage.GetLatestLocalFile(index); TEST(localFileB.get(), ()); TEST_EQUAL(localFileA.get(), localFileB.get(), (*localFileA, *localFileB)); - TEST_EQUAL(TMapOptions::Map, localFileB->GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, localFileB->GetFiles(), ()); - storage.DeleteCountry(index, TMapOptions::Map); + storage.DeleteCountry(index, MapOptions::Map); shared_ptr<LocalCountryFile> localFileC = storage.GetLatestLocalFile(index); TEST(!localFileC.get(), (*localFileC)); } @@ -438,28 +438,28 @@ UNIT_TEST(StorageTest_DownloadMapAndRoutingSeparately) TEST(index.IsValid(), ()); CountryFile const countryFile = storage.GetCountryFile(index); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); // Download map file only. { unique_ptr<CountryDownloaderChecker> checker = - AbsentCountryDownloaderChecker(storage, index, TMapOptions::Map); + AbsentCountryDownloaderChecker(storage, index, MapOptions::Map); checker->StartDownload(); runner.Run(); } shared_ptr<LocalCountryFile> localFileA = storage.GetLatestLocalFile(index); TEST(localFileA.get(), ()); - TEST_EQUAL(TMapOptions::Map, localFileA->GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, localFileA->GetFiles(), ()); MwmSet::MwmId id = mwmSet.GetMwmIdByCountryFile(countryFile); TEST(id.IsAlive(), ()); - TEST_EQUAL(TMapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); // Download routing file in addition to exising map file. { unique_ptr<CountryDownloaderChecker> checker = - PresentCountryDownloaderChecker(storage, index, TMapOptions::CarRouting); + PresentCountryDownloaderChecker(storage, index, MapOptions::CarRouting); checker->StartDownload(); runner.Run(); } @@ -467,34 +467,34 @@ UNIT_TEST(StorageTest_DownloadMapAndRoutingSeparately) shared_ptr<LocalCountryFile> localFileB = storage.GetLatestLocalFile(index); TEST(localFileB.get(), ()); TEST_EQUAL(localFileA.get(), localFileB.get(), (*localFileA, *localFileB)); - TEST_EQUAL(TMapOptions::MapWithCarRouting, localFileB->GetFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, localFileB->GetFiles(), ()); TEST(id.IsAlive(), ()); - TEST_EQUAL(TMapOptions::MapWithCarRouting, id.GetInfo()->GetLocalFile().GetFiles(), ()); + TEST_EQUAL(MapOptions::MapWithCarRouting, id.GetInfo()->GetLocalFile().GetFiles(), ()); // Delete routing file and check status update. { CountryStatusChecker checker(storage, index, TStatus::EOnDisk); - storage.DeleteCountry(index, TMapOptions::CarRouting); + storage.DeleteCountry(index, MapOptions::CarRouting); } shared_ptr<LocalCountryFile> localFileC = storage.GetLatestLocalFile(index); TEST(localFileC.get(), ()); TEST_EQUAL(localFileB.get(), localFileC.get(), (*localFileB, *localFileC)); - TEST_EQUAL(TMapOptions::Map, localFileC->GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, localFileC->GetFiles(), ()); TEST(id.IsAlive(), ()); - TEST_EQUAL(TMapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); // Delete map file and check status update. { CountryStatusChecker checker(storage, index, TStatus::ENotDownloaded); - storage.DeleteCountry(index, TMapOptions::Map); + storage.DeleteCountry(index, MapOptions::Map); } // Framework should notify MwmSet about deletion of a map file. // As there're no framework, there should not be any changes in MwmInfo. TEST(id.IsAlive(), ()); - TEST_EQUAL(TMapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, id.GetInfo()->GetLocalFile().GetFiles(), ()); } UNIT_TEST(StorageTest_DeletePendingCountry) @@ -505,13 +505,13 @@ UNIT_TEST(StorageTest_DeletePendingCountry) TIndex const index = storage.FindIndexByFile("Azerbaijan"); TEST(index.IsValid(), ()); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); { unique_ptr<CountryDownloaderChecker> checker = - CancelledCountryDownloaderChecker(storage, index, TMapOptions::Map); + CancelledCountryDownloaderChecker(storage, index, MapOptions::Map); checker->StartDownload(); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); runner.Run(); } } @@ -524,21 +524,21 @@ UNIT_TEST(StorageTest_DownloadTwoCountriesAndDelete) TIndex const uruguayIndex = storage.FindIndexByFile("Uruguay"); TEST(uruguayIndex.IsValid(), ()); - storage.DeleteCountry(uruguayIndex, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(uruguayIndex, MapOptions::MapWithCarRouting); MY_SCOPE_GUARD(cleanupUruguayFiles, bind(&Storage::DeleteCountry, &storage, uruguayIndex, - TMapOptions::MapWithCarRouting)); + MapOptions::MapWithCarRouting)); TIndex const venezuelaIndex = storage.FindIndexByFile("Venezuela"); TEST(venezuelaIndex.IsValid(), ()); - storage.DeleteCountry(venezuelaIndex, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(venezuelaIndex, MapOptions::MapWithCarRouting); MY_SCOPE_GUARD(cleanupVenezuelaFiles, bind(&Storage::DeleteCountry, &storage, venezuelaIndex, - TMapOptions::MapWithCarRouting)); + MapOptions::MapWithCarRouting)); { // Map file will be deleted for Uruguay, thus, routing file should also be deleted. Therefore, // Uruguay should pass through following states: NotDownloaded -> Downloading -> NotDownloaded. unique_ptr<CountryDownloaderChecker> uruguayChecker = make_unique<CountryDownloaderChecker>( - storage, uruguayIndex, TMapOptions::MapWithCarRouting, + storage, uruguayIndex, MapOptions::MapWithCarRouting, vector<TStatus>{TStatus::ENotDownloaded, TStatus::EDownloading, TStatus::ENotDownloaded}); // Only routing file will be deleted for Venezuela, thus, Venezuela should pass through // following @@ -546,13 +546,13 @@ UNIT_TEST(StorageTest_DownloadTwoCountriesAndDelete) // NotDownloaded -> InQueue (Venezuela is added after Uruguay) -> Downloading -> Downloading // (second notification will be sent after deletion of a routing file) -> OnDisk. unique_ptr<CountryDownloaderChecker> venezuelaChecker = make_unique<CountryDownloaderChecker>( - storage, venezuelaIndex, TMapOptions::MapWithCarRouting, + storage, venezuelaIndex, MapOptions::MapWithCarRouting, vector<TStatus>{TStatus::ENotDownloaded, TStatus::EInQueue, TStatus::EDownloading, TStatus::EDownloading, TStatus::EOnDisk}); uruguayChecker->StartDownload(); venezuelaChecker->StartDownload(); - storage.DeleteCountry(uruguayIndex, TMapOptions::Map); - storage.DeleteCountry(venezuelaIndex, TMapOptions::CarRouting); + storage.DeleteCountry(uruguayIndex, MapOptions::Map); + storage.DeleteCountry(venezuelaIndex, MapOptions::CarRouting); runner.Run(); } shared_ptr<LocalCountryFile> uruguayFile = storage.GetLatestLocalFile(uruguayIndex); @@ -560,7 +560,7 @@ UNIT_TEST(StorageTest_DownloadTwoCountriesAndDelete) shared_ptr<LocalCountryFile> venezuelaFile = storage.GetLatestLocalFile(venezuelaIndex); TEST(venezuelaFile.get(), ()); - TEST_EQUAL(TMapOptions::Map, venezuelaFile->GetFiles(), ()); + TEST_EQUAL(MapOptions::Map, venezuelaFile->GetFiles(), ()); } UNIT_TEST(StorageTest_CancelDownloadingWhenAlmostDone) @@ -571,9 +571,9 @@ UNIT_TEST(StorageTest_CancelDownloadingWhenAlmostDone) TIndex const index = storage.FindIndexByFile("Uruguay"); TEST(index.IsValid(), ()); - storage.DeleteCountry(index, TMapOptions::MapWithCarRouting); + storage.DeleteCountry(index, MapOptions::MapWithCarRouting); MY_SCOPE_GUARD(cleanupFiles, - bind(&Storage::DeleteCountry, &storage, index, TMapOptions::MapWithCarRouting)); + bind(&Storage::DeleteCountry, &storage, index, MapOptions::MapWithCarRouting)); { CancelDownloadingWhenAlmostDoneChecker checker(storage, index, runner); |