/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
storage/storage_integration_tests/lightweight_matching_tests.cpp
51 строка
1 KB
Mikhail Gorbushin
[geometry] Get rid of MercatorBounds, refactor to namespace mercator
01 ноя 2019, 11:09
01 ноя 2019, 11:09
6f5d401
Код
Авторство
О чём код?
#include "testing/testing.hpp" #include "storage/country_info_reader_light.hpp" #include "storage/storage_defines.hpp" #include "geometry/mercator.hpp" #include "geometry/point2d.hpp" #include <utility> #include <vector> using namespace lightweight; namespace { double constexpr kStepInMercator = 1; struct PointAndCountry { PointAndCountry(m2::PointD && pt, storage::CountryId && country) : m_pt(std::move(pt)), m_country(std::move(country)) { } m2::PointD m_pt; storage::CountryId m_country; }; UNIT_CLASS_TEST(CountryInfoReader, LightweightMatching) { auto const reader = storage::CountryInfoReader::CreateCountryInfoReader(GetPlatform()); LOG(LINFO, ("Generating dataset...")); std::vector<PointAndCountry> dataset; for (auto x = mercator::Bounds::kMinX; x <= mercator::Bounds::kMaxX; x += kStepInMercator) { for (auto y = mercator::Bounds::kMinY; y <= mercator::Bounds::kMaxY; y += kStepInMercator) { m2::PointD pt(x, y); dataset.emplace_back(std::move(pt), reader->GetRegionCountryId(pt)); } } LOG(LINFO, ("The dataset is generated. Dataset size:", dataset.size())); for (auto const & sample : dataset) { TEST_EQUAL(GetRegionCountryId(sample.m_pt), sample.m_country, (sample.m_pt)); } } } // namespace