forked from organicmaps/organicmaps
[generator] osm_type_test.cpp refactoring.
This commit is contained in:
parent
6b10a65069
commit
1d59091362
1 changed files with 34 additions and 130 deletions
|
@ -83,11 +83,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_SkipDummy)
|
|||
{ "ref", "E51" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST_EQUAL(params.m_types[0], GetType(arr[1]), ());
|
||||
|
@ -138,11 +135,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Combined)
|
|||
{ "name", "Гимназия 15" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 2, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[3])), ());
|
||||
|
@ -167,11 +161,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Address)
|
|||
{ "uir_adr:ADRESA_KOD", "21717036" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"building", "address"})), ());
|
||||
|
@ -193,11 +184,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_PlaceState)
|
|||
{ "ref", "CA" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "state", "USA"})), ());
|
||||
|
@ -271,7 +259,7 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Synonyms)
|
|||
|
||||
TagReplacer tagReplacer(GetPlatform().ResourcesDir() + REPLACED_TAGS_FILE);
|
||||
tagReplacer(e);
|
||||
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
|
||||
|
@ -298,11 +286,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Synonyms)
|
|||
{ "atm", "yes" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"amenity", "atm"})), ());
|
||||
|
@ -316,11 +301,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Synonyms)
|
|||
{ "atm", "no" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"building"})), ());
|
||||
|
@ -336,11 +318,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Capital)
|
|||
{ "place", "city" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city", "capital", "6"})), ());
|
||||
|
@ -353,11 +332,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Capital)
|
|||
{ "place", "city" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city"})), ());
|
||||
|
@ -372,11 +348,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Capital)
|
|||
{ "place", "city" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 2, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city", "capital", "2"})), ());
|
||||
|
@ -392,11 +365,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Route)
|
|||
{ "ref", "I 95" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[0])), ());
|
||||
|
@ -413,11 +383,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Layer)
|
|||
{ "layer", "2" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"highway", "motorway", "bridge"})), ());
|
||||
|
@ -431,11 +398,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Layer)
|
|||
{ "layer", "-1" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"highway", "trunk", "tunnel"})), ());
|
||||
|
@ -448,11 +412,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Layer)
|
|||
{ "bridge", "yes" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"highway", "secondary", "bridge"})), ());
|
||||
|
@ -465,11 +426,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Layer)
|
|||
{ "tunnel", "yes" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"highway", "primary", "tunnel"})), ());
|
||||
|
@ -481,11 +439,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Layer)
|
|||
{ "highway", "living_street" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[0])), ());
|
||||
|
@ -501,11 +456,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Amenity)
|
|||
{ "fuel", "wood" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[0])), ());
|
||||
|
@ -526,11 +478,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hwtag)
|
|||
{ "oneway", "true" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[0])), ());
|
||||
|
@ -547,11 +496,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hwtag)
|
|||
{"oneway:bicycle", "no"},
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 6, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[1])), ());
|
||||
|
@ -567,11 +513,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hwtag)
|
|||
{"foot", "yes"}, {"cycleway", "lane"}, {"highway", "primary"},
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 3, (params));
|
||||
TEST(params.IsTypeExist(GetType(arr[2])), ());
|
||||
|
@ -611,11 +554,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Ferry)
|
|||
{ "route", "ferry" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 3, (params));
|
||||
|
||||
|
@ -653,7 +593,7 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_YesCarNoCar)
|
|||
}
|
||||
|
||||
{
|
||||
char const* arr[][2] = {
|
||||
char const * arr[][2] = {
|
||||
{"highway", "cycleway"},
|
||||
{"motorcar", "yes"},
|
||||
};
|
||||
|
@ -690,11 +630,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Boundary)
|
|||
{ "boundary", "administrative" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 2, (params));
|
||||
TEST(params.IsTypeExist(GetType({"boundary", "administrative", "2"})), ());
|
||||
|
@ -715,11 +652,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Dibrugarh)
|
|||
{ "website", "http://www.hotelvishal.in" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city"})), (params));
|
||||
|
@ -739,11 +673,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Subway)
|
|||
{ "transport", "subway" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"railway", "station", "subway", "moscow"})), (params));
|
||||
|
@ -758,11 +689,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Subway)
|
|||
{ "route", "subway" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 2, (params));
|
||||
TEST(params.IsTypeExist(GetType({"railway", "station", "subway", "newyork"})), (params));
|
||||
|
@ -778,11 +706,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Subway)
|
|||
{ "station", "light_rail" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"railway", "station", "light_rail"})), (params));
|
||||
|
@ -800,11 +725,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Subway)
|
|||
{ "transport", "monorail" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"railway", "station", "monorail"})), (params));
|
||||
|
@ -819,11 +741,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Subway)
|
|||
{ "railway", "station" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"railway", "station", "subway", "london"})), (params));
|
||||
|
@ -837,11 +756,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hospital)
|
|||
{ "building", "hospital" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"building"})), (params));
|
||||
|
@ -853,11 +769,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hospital)
|
|||
{ "amenity", "hospital" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 2, (params));
|
||||
TEST(params.IsTypeExist(GetType({"building"})), (params));
|
||||
|
@ -912,11 +825,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Moscow)
|
|||
{ "wikipedia", "ru:Москва" },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city", "capital", "2"})), (params));
|
||||
|
@ -937,11 +847,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Translations)
|
|||
{ "population", "2243833" }
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"place", "city"})), ());
|
||||
|
@ -963,11 +870,8 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Cuisine)
|
|||
{ "cuisine", "indian ; steak,coffee shop " },
|
||||
};
|
||||
|
||||
OsmElement e;
|
||||
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
|
||||
|
||||
FeatureParams params;
|
||||
ftype::GetNameAndType(&e, params);
|
||||
GetFeatureParams(arr, ARRAY_SIZE(arr), params);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 3, (params));
|
||||
TEST(params.IsTypeExist(GetType({"cuisine", "indian"})), (params));
|
||||
|
|
Loading…
Add table
Reference in a new issue