From bfa9478db6722b5f2acc92b8962b9e54ef067676 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Tue, 6 Jun 2017 15:40:04 +0300 Subject: [PATCH] review fixes --- indexer/CMakeLists.txt | 1 + indexer/indexer_tests/CMakeLists.txt | 1 + indexer/indexer_tests/indexer_tests.pro | 1 + indexer/indexer_tests/wheelchair_tests.cpp | 34 +++++++++++++++++++ indexer/wheelchair.hpp | 6 ++-- .../indexer/indexer.xcodeproj/project.pbxproj | 16 +++++++++ 6 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 indexer/indexer_tests/wheelchair_tests.cpp diff --git a/indexer/CMakeLists.txt b/indexer/CMakeLists.txt index e3f074ff67..8051eada66 100644 --- a/indexer/CMakeLists.txt +++ b/indexer/CMakeLists.txt @@ -127,6 +127,7 @@ set( types_mapping.cpp types_mapping.hpp unique_index.hpp + wheelchair.hpp ) set( diff --git a/indexer/indexer_tests/CMakeLists.txt b/indexer/indexer_tests/CMakeLists.txt index 3fcf24f0d7..ffadc3d332 100644 --- a/indexer/indexer_tests/CMakeLists.txt +++ b/indexer/indexer_tests/CMakeLists.txt @@ -36,6 +36,7 @@ set( test_type.cpp trie_test.cpp visibility_test.cpp + wheelchair_tests.cpp ) omim_add_test(${PROJECT_NAME} ${SRC}) diff --git a/indexer/indexer_tests/indexer_tests.pro b/indexer/indexer_tests/indexer_tests.pro index e324f2a352..78d6fe1d5f 100644 --- a/indexer/indexer_tests/indexer_tests.pro +++ b/indexer/indexer_tests/indexer_tests.pro @@ -59,3 +59,4 @@ SOURCES += \ test_type.cpp \ trie_test.cpp \ visibility_test.cpp \ + wheelchair_tests.cpp \ diff --git a/indexer/indexer_tests/wheelchair_tests.cpp b/indexer/indexer_tests/wheelchair_tests.cpp new file mode 100644 index 0000000000..642955596f --- /dev/null +++ b/indexer/indexer_tests/wheelchair_tests.cpp @@ -0,0 +1,34 @@ +#include "testing/testing.hpp" + +#include "indexer/classificator.hpp" +#include "indexer/classificator_loader.hpp" +#include "indexer/wheelchair.hpp" + +UNIT_TEST(Wheelchair_GetType) +{ + classificator::Load(); + Classificator const & c = classif(); + + feature::TypesHolder holder; + { + holder.Assign(c.GetTypeByPath({"wheelchair", "no"})); + TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::No, ()); + } + { + holder.Assign(c.GetTypeByPath({"wheelchair", "yes"})); + TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Yes, ()); + } + { + holder.Assign(c.GetTypeByPath({"wheelchair", "limited"})); + TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Limited, ()); + } + { + holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); + TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::No, ()); + } + { + holder.Assign(c.GetTypeByPath({"amenity", "dentist"})); + holder.Add(c.GetTypeByPath({"wheelchair", "yes"})); + TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Yes, ()); + } +} diff --git a/indexer/wheelchair.hpp b/indexer/wheelchair.hpp index a1029fca59..815094f186 100644 --- a/indexer/wheelchair.hpp +++ b/indexer/wheelchair.hpp @@ -1,9 +1,12 @@ #pragma once #include "indexer/feature.hpp" +#include "indexer/feature_data.hpp" #include "indexer/ftypes_mapping.hpp" +#include #include +#include namespace wheelchair { @@ -14,7 +17,7 @@ enum class Type Limited }; -inline string DebugPrint(Type wheelchair) +inline std::string DebugPrint(Type wheelchair) { switch (wheelchair) { @@ -22,7 +25,6 @@ inline string DebugPrint(Type wheelchair) case Type::Yes: return "Yes"; case Type::Limited: return "Limited"; } - return {}; } class Matcher diff --git a/xcode/indexer/indexer.xcodeproj/project.pbxproj b/xcode/indexer/indexer.xcodeproj/project.pbxproj index 71ca52b3b3..1bebc96b88 100644 --- a/xcode/indexer/indexer.xcodeproj/project.pbxproj +++ b/xcode/indexer/indexer.xcodeproj/project.pbxproj @@ -42,6 +42,10 @@ 34AF87E61DBE565F00E5E7DC /* helpers.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34AF87E41DBE565F00E5E7DC /* helpers.hpp */; }; 34AF87E71DBE567C00E5E7DC /* libindexer_tests_support.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34AF87D71DBE561400E5E7DC /* libindexer_tests_support.a */; }; 34AF87E81DBE570200E5E7DC /* helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34AF87E31DBE565F00E5E7DC /* helpers.cpp */; }; + 3D452AF61EE6D3A0009EAB9B /* wheelchair.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */; }; + 3D452AFA1EE6D9F5009EAB9B /* wheelchair_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */; }; + 3D452AFB1EE6D9F5009EAB9B /* feature_names_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */; }; + 3D452AFC1EE6D9F5009EAB9B /* centers_table_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */; }; 3D489BC61D3D220F0052AA38 /* editable_map_object_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA71D3D1F8A0052AA38 /* editable_map_object_test.cpp */; }; 3D489BC71D3D22150052AA38 /* features_vector_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA81D3D1F8A0052AA38 /* features_vector_test.cpp */; }; 3D489BC81D3D22190052AA38 /* string_slice_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA91D3D1F8A0052AA38 /* string_slice_tests.cpp */; }; @@ -263,6 +267,10 @@ 34AF87D71DBE561400E5E7DC /* libindexer_tests_support.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libindexer_tests_support.a; sourceTree = BUILT_PRODUCTS_DIR; }; 34AF87E31DBE565F00E5E7DC /* helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = helpers.cpp; sourceTree = ""; }; 34AF87E41DBE565F00E5E7DC /* helpers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = helpers.hpp; sourceTree = ""; }; + 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = wheelchair.hpp; sourceTree = ""; }; + 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wheelchair_tests.cpp; sourceTree = ""; }; + 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = feature_names_test.cpp; sourceTree = ""; }; + 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = centers_table_test.cpp; sourceTree = ""; }; 3D489BA71D3D1F8A0052AA38 /* editable_map_object_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = editable_map_object_test.cpp; sourceTree = ""; }; 3D489BA81D3D1F8A0052AA38 /* features_vector_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = features_vector_test.cpp; sourceTree = ""; }; 3D489BA91D3D1F8A0052AA38 /* string_slice_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_slice_tests.cpp; sourceTree = ""; }; @@ -563,6 +571,9 @@ 670C60F81AB0657700C38A8C /* indexer_tests */ = { isa = PBXGroup; children = ( + 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */, + 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */, + 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */, 45C108AF1E9CFE3E000FE1F6 /* polyline_point_to_int64_test.cpp */, 3D489BF11D4F87740052AA38 /* osm_editor_test.cpp */, 3D489BF21D4F87740052AA38 /* osm_editor_test.hpp */, @@ -639,6 +650,7 @@ 6753409C1A3F53CB00A0A8C3 /* indexer */ = { isa = PBXGroup; children = ( + 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */, 3D74ABBB1EA67C1E0063A898 /* ftypes_mapping.hpp */, 3D928F651D50F9FE001670E0 /* index_helpers.cpp */, 3D928F661D50F9FE001670E0 /* index_helpers.hpp */, @@ -843,6 +855,7 @@ 6753414B1A3F540F00A0A8C3 /* tesselator_decl.hpp in Headers */, F61F83071E4B187500B37B7A /* road_shields_parser.hpp in Headers */, 347F33801C454242009758CC /* trie_reader.hpp in Headers */, + 3D452AF61EE6D3A0009EAB9B /* wheelchair.hpp in Headers */, 675341191A3F540F00A0A8C3 /* feature_decl.hpp in Headers */, 674125141B4C02F100A3E828 /* map_style_reader.hpp in Headers */, 675341221A3F540F00A0A8C3 /* feature_utils.hpp in Headers */, @@ -1054,6 +1067,7 @@ 6753414D1A3F540F00A0A8C3 /* types_mapping.cpp in Sources */, 6753412A1A3F540F00A0A8C3 /* geometry_coding.cpp in Sources */, 34583BC71C88552100F94664 /* cuisines.cpp in Sources */, + 3D452AFA1EE6D9F5009EAB9B /* wheelchair_tests.cpp in Sources */, 675341121A3F540F00A0A8C3 /* feature_algo.cpp in Sources */, 675341211A3F540F00A0A8C3 /* feature_utils.cpp in Sources */, 675341231A3F540F00A0A8C3 /* feature_visibility.cpp in Sources */, @@ -1070,6 +1084,8 @@ 6753412C1A3F540F00A0A8C3 /* geometry_serialization.cpp in Sources */, F61F83061E4B187500B37B7A /* road_shields_parser.cpp in Sources */, 670EE56C1B60033A001E8064 /* features_vector.cpp in Sources */, + 3D452AFB1EE6D9F5009EAB9B /* feature_names_test.cpp in Sources */, + 3D452AFC1EE6D9F5009EAB9B /* centers_table_test.cpp in Sources */, 34664CF31D49FEC1003D7096 /* altitude_loader.cpp in Sources */, 6726C1D11A49DAAC005EEA39 /* feature_meta.cpp in Sources */, 6753411C1A3F540F00A0A8C3 /* feature_loader_base.cpp in Sources */,