diff options
author | vng <viktor.govako@gmail.com> | 2012-06-15 04:30:25 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:39:49 +0300 |
commit | cd104f6ef648851b865b5f81fa2504d268bb01d1 (patch) | |
tree | fa0691e75f5cfe7c547f3ca13833e9497bb29074 | |
parent | 3bf4612313d26ce7b43098a4851c2e4bddbaed19 (diff) |
Add tests for osm types.
-rw-r--r-- | generator/generator_tests/osm_type_test.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/generator/generator_tests/osm_type_test.cpp b/generator/generator_tests/osm_type_test.cpp index c7de69e636..932e229553 100644 --- a/generator/generator_tests/osm_type_test.cpp +++ b/generator/generator_tests/osm_type_test.cpp @@ -139,3 +139,58 @@ UNIT_TEST(OsmType_Combined) TEST_EQUAL(params.house.Get(), "84", ()); } + +UNIT_TEST(OsmType_Address) +{ + char const * arr[][2] = { + { "addr:conscriptionnumber", "223" }, + { "addr:housenumber", "223/5" }, + { "addr:postcode", "11000" }, + { "addr:street", "Řetězová" }, + { "addr:streetnumber", "5" }, + { "source:addr", "uir_adr" }, + { "uir_adr:ADRESA_KOD", "21717036" } + }; + + XMLElement e; + FillXmlElement(arr, ARRAY_SIZE(arr), &e); + + FeatureParams params; + ftype::GetNameAndType(&e, params); + + Classificator & c = classif(); + char const * arrT[] = { "building", "address" }; + TEST(params.IsTypeExist(c.GetTypeByPath(vector<string>(arrT, arrT + 2))), ()); + + TEST_EQUAL(params.house.Get(), "223/5", ()); +} + +UNIT_TEST(OsmType_PlaceState) +{ + char const * arr[][2] = { + { "alt_name:vi", "California" }, + { "is_in", "USA" }, + { "is_in:continent", "North America" }, + { "is_in:country", "USA" }, + { "is_in:country_code", "us" }, + { "name", "California" }, + { "place", "state" }, + { "population", "37253956" }, + { "ref", "CA" } + }; + + XMLElement e; + FillXmlElement(arr, ARRAY_SIZE(arr), &e); + + FeatureParams params; + ftype::GetNameAndType(&e, params); + + Classificator & c = classif(); + char const * arrT[] = { "place", "state", "USA" }; + TEST(params.IsTypeExist(c.GetTypeByPath(vector<string>(arrT, arrT + 3))), ()); + + string s; + TEST(params.name.GetString(0, s), ()); + TEST_EQUAL(s, "California", ()); + TEST_GREATER(params.rank, 1, ()); +} |