diff options
author | Arsentiy Milchakov <a.milchakov@corp.mail.ru> | 2016-08-30 11:48:46 +0300 |
---|---|---|
committer | Arsentiy Milchakov <a.milchakov@corp.mail.ru> | 2016-08-30 11:48:46 +0300 |
commit | f1d3a34101014fcf1f1294d588944cc3fe7ccb36 (patch) | |
tree | e5f523d3515a5bbf42f025bc48726b9fdee6c93d /indexer/indexer_tests | |
parent | 39103b30cf1fcb94801d6725f60897c85df45304 (diff) |
names optimization and fix
Diffstat (limited to 'indexer/indexer_tests')
-rw-r--r-- | indexer/indexer_tests/feature_names_test.cpp | 39 | ||||
-rw-r--r-- | indexer/indexer_tests/indexer_tests.pro | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/indexer/indexer_tests/feature_names_test.cpp b/indexer/indexer_tests/feature_names_test.cpp new file mode 100644 index 0000000000..bc44e5bcec --- /dev/null +++ b/indexer/indexer_tests/feature_names_test.cpp @@ -0,0 +1,39 @@ +#include "testing/testing.hpp" + +#include "indexer/features_vector.hpp" +#include "indexer/index.hpp" +#include "indexer/mwm_set.hpp" + +#include "platform/local_country_file.hpp" + +using namespace platform; + +namespace +{ +UNIT_TEST(GetFeatureNames) +{ + LocalCountryFile localFile = LocalCountryFile::MakeForTesting("minsk-pass"); + + Index index; + auto result = index.RegisterMap(localFile); + TEST_EQUAL(result.second, MwmSet::RegResult::Success, ()); + + auto const & id = result.first; + MwmSet::MwmHandle handle = index.GetMwmHandleById(id); + TEST(handle.IsAlive(), ()); + + auto const * value = handle.GetValue<MwmValue>(); + FeaturesVector fv(value->m_cont, value->GetHeader(), value->m_table.get()); + string primary, secondary, readable; + + fv.ForEach([&](FeatureType & ft, uint32_t /* index */) + { + ft.GetPreferredNames(primary, secondary); + if (!secondary.empty()) + { + ft.GetReadableName(readable); + TEST_EQUAL(secondary, readable, ()); + } + }); +} +} // namespace diff --git a/indexer/indexer_tests/indexer_tests.pro b/indexer/indexer_tests/indexer_tests.pro index 43abbd013a..68246f9005 100644 --- a/indexer/indexer_tests/indexer_tests.pro +++ b/indexer/indexer_tests/indexer_tests.pro @@ -28,6 +28,7 @@ SOURCES += \ drules_selector_parser_test.cpp \ editable_map_object_test.cpp \ feature_metadata_test.cpp \ + feature_names_test.cpp \ feature_xml_test.cpp \ features_offsets_table_test.cpp \ features_vector_test.cpp \ |