diff options
author | ygorshenin <mipt.vi002@gmail.com> | 2016-08-30 15:47:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 15:47:27 +0300 |
commit | 530f7c270356993c362e216ae177806fca4d8850 (patch) | |
tree | 7ec3d37e02699e010f9e645fb6b9af02e691e9a7 /indexer/indexer_tests | |
parent | 11a4e21c76fdeb7d738f4cf6aae5becca3b0d6a7 (diff) | |
parent | f1d3a34101014fcf1f1294d588944cc3fe7ccb36 (diff) |
Merge pull request #4143 from milchakov/names_optimization_and_fix
[drape][indexer] 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 81b1b08b1b..786d1df331 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 \ |