From 10d3c52af253c0cbd67d0b4790d8aa48d83d9d0d Mon Sep 17 00:00:00 2001 From: vng Date: Mon, 19 Oct 2015 14:05:15 +0300 Subject: [PATCH] Review fixes. --- .../generator_tests/feature_builder_test.cpp | 22 ++++++++++++++----- indexer/classificator.cpp | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/generator/generator_tests/feature_builder_test.cpp b/generator/generator_tests/feature_builder_test.cpp index 6c8664ab7a..c4a78757b3 100644 --- a/generator/generator_tests/feature_builder_test.cpp +++ b/generator/generator_tests/feature_builder_test.cpp @@ -105,12 +105,24 @@ UNIT_TEST(FVisibility_RemoveNoDrawableTypes) classificator::Load(); Classificator const & c = classif(); - vector types; - types.push_back(c.GetTypeByPath({ "building" })); - types.push_back(c.GetTypeByPath({ "amenity", "theatre" })); + { + vector types; + types.push_back(c.GetTypeByPath({ "building" })); + types.push_back(c.GetTypeByPath({ "amenity", "theatre" })); - TEST(feature::RemoveNoDrawableTypes(types, feature::GEOM_AREA), ()); - TEST_EQUAL(types.size(), 2, ()); + TEST(feature::RemoveNoDrawableTypes(types, feature::GEOM_AREA), ()); + TEST_EQUAL(types.size(), 2, ()); + } + + { + vector types; + types.push_back(c.GetTypeByPath({ "amenity" })); + types.push_back(c.GetTypeByPath({ "building" })); + + TEST(feature::RemoveNoDrawableTypes(types, feature::GEOM_AREA, true), ()); + TEST_EQUAL(types.size(), 1, ()); + TEST_EQUAL(types[0], c.GetTypeByPath({ "building" }), ()); + } } UNIT_TEST(FBuilder_RemoveUselessNames) diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index dd9da03464..8f4ad4dc77 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -56,7 +56,7 @@ void ClassifObject::AddDrawRule(drule::Key const & k) ClassifObjectPtr ClassifObject::BinaryFind(string const & s) const { - auto i = lower_bound(m_objs.begin(), m_objs.end(), s, less_name_t()); + auto const i = lower_bound(m_objs.begin(), m_objs.end(), s, less_name_t()); if ((i == m_objs.end()) || ((*i).m_name != s)) return ClassifObjectPtr(0, 0); else @@ -314,7 +314,7 @@ bool ClassifObject::IsDrawableLike(feature::EGeomType ft, bool emptyName) const { ASSERT_LESS(k.m_type, drule::count_of_rules, ()); - // In case when feature name is empty we donn't take into account caption drawing rules. + // In case when feature name is empty we don't take into account caption drawing rules. if ((visible[ft][k.m_type] == 1) && (!emptyName || (k.m_type != drule::caption && k.m_type != drule::pathtext))) {