diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-03-13 17:58:09 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-03-15 13:06:50 +0300 |
commit | 2c4016178ca53f899de7b8c7606baa6cd8a482eb (patch) | |
tree | 3e911b7dcaab70bf8a1682587ead6631a4eafe3b /search | |
parent | b5828d64d61f22db6278b23cea6b9c229968f97e (diff) |
[tests] Convert TestFeature m_name to StringUtf8Multilang.
Diffstat (limited to 'search')
-rw-r--r-- | search/search_integration_tests/processor_test.cpp | 30 | ||||
-rw-r--r-- | search/search_integration_tests/ranker_test.cpp | 4 | ||||
-rw-r--r-- | search/search_integration_tests/smoke_test.cpp | 11 |
3 files changed, 25 insertions, 20 deletions
diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index a7010f8088..69d6f3f793 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -187,14 +187,14 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) TestStreet firstAprilStreet(vector<m2::PointD>{m2::PointD(14.998, 15), m2::PointD(15.002, 15)}, "1st April street", "en"); - TestBuilding feynmanHouse(m2::PointD(10, 10), "Feynman house", "1 unit 1", feynmanStreet, "en"); - TestBuilding bohrHouse(m2::PointD(10, 10), "Bohr house", "1 unit 1", bohrStreet1, "en"); + TestBuilding feynmanHouse(m2::PointD(10, 10), "Feynman house", "1 unit 1", feynmanStreet.GetName("en"), "en"); + TestBuilding bohrHouse(m2::PointD(10, 10), "Bohr house", "1 unit 1", bohrStreet1.GetName("en"), "en"); TestBuilding hilbertHouse( vector<m2::PointD>{ {10.0005, 10.0005}, {10.0006, 10.0005}, {10.0006, 10.0006}, {10.0005, 10.0006}}, - "Hilbert house", "1 unit 2", bohrStreet1, "en"); + "Hilbert house", "1 unit 2", bohrStreet1.GetName("en"), "en"); TestBuilding descartesHouse(m2::PointD(10, 10), "Descartes house", "2", "en"); - TestBuilding bornHouse(m2::PointD(14.999, 15), "Born house", "8", firstAprilStreet, "en"); + TestBuilding bornHouse(m2::PointD(14.999, 15), "Born house", "8", firstAprilStreet.GetName("en"), "en"); TestPOI busStop(m2::PointD(0, 0), "Bus stop", "en"); TestPOI tramStop(m2::PointD(0.0001, 0.0001), "Tram stop", "en"); @@ -202,7 +202,7 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) TestPOI quantumTeleport2(m2::PointD(10, 10), "Quantum teleport 2", "en"); quantumTeleport2.SetHouseNumber("3"); - quantumTeleport2.SetStreetName(feynmanStreet.GetName()); + quantumTeleport2.SetStreetName(feynmanStreet.GetName("en")); TestPOI quantumCafe(m2::PointD(-0.0002, -0.0002), "Quantum cafe", "en"); TestPOI lantern1(m2::PointD(10.0005, 10.0005), "lantern 1", "en"); @@ -211,7 +211,7 @@ UNIT_CLASS_TEST(ProcessorTest, Smoke) TestStreet stradaDrive(vector<m2::PointD>{m2::PointD(-10.001, -10.001), m2::PointD(-10, -10), m2::PointD(-9.999, -9.999)}, "Strada drive", "en"); - TestBuilding terranceHouse(m2::PointD(-10, -10), "", "155", stradaDrive, "en"); + TestBuilding terranceHouse(m2::PointD(-10, -10), "", "155", stradaDrive.GetName("en"), "en"); BuildWorld([&](TestMwmBuilder & builder) { @@ -638,10 +638,10 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes) "Первомайская", "ru"); street.SetPostcode("141701"); - TestBuilding building28(m2::PointD(0.0, 0.00001), "", "28а", street, "ru"); + TestBuilding building28(m2::PointD(0.0, 0.00001), "", "28а", street.GetName("ru"), "ru"); building28.SetPostcode("141701"); - TestBuilding building29(m2::PointD(0.0, -0.00001), "", "29", street, "ru"); + TestBuilding building29(m2::PointD(0.0, -0.00001), "", "29", street.GetName("ru"), "ru"); building29.SetPostcode("141701"); TestPOI building30(m2::PointD(0.00002, 0.00002), "", "en"); @@ -649,7 +649,7 @@ UNIT_CLASS_TEST(ProcessorTest, TestPostcodes) building30.SetPostcode("141701"); building30.SetTypes({{"building", "address"}}); - TestBuilding building31(m2::PointD(0.00001, 0.00001), "", "31", street, "ru"); + TestBuilding building31(m2::PointD(0.00001, 0.00001), "", "31", street.GetName("ru"), "ru"); building31.SetPostcode("141702"); TestBuilding building1(m2::PointD(10, 10), "", "1", "en"); @@ -1115,7 +1115,7 @@ UNIT_CLASS_TEST(ProcessorTest, StopWords) builder.Add(city); }); - auto id = BuildCountry(country.GetName(), [&](TestMwmBuilder & builder) { + auto id = BuildCountry(country.GetName("en"), [&](TestMwmBuilder & builder) { builder.Add(street); builder.Add(bakery); }); @@ -1151,7 +1151,7 @@ UNIT_CLASS_TEST(ProcessorTest, Numerals) TestPOI school(m2::PointD(0, 0), "СШ №61", "ru"); school.SetTypes({{"amenity", "school"}}); - auto id = BuildCountry(country.GetName(), [&](TestMwmBuilder & builder) { builder.Add(school); }); + auto id = BuildCountry(country.GetName("ru"), [&](TestMwmBuilder & builder) { builder.Add(school); }); SetViewport(m2::RectD(m2::PointD(-1.0, -1.0), m2::PointD(1.0, 1.0))); { @@ -1307,8 +1307,8 @@ UNIT_CLASS_TEST(ProcessorTest, RelaxedRetrieval) TestStreet street(vector<m2::PointD>{m2::PointD(-1.0, 0.0), m2::PointD(1.0, 0.0)}, "Queer Street", "en"); - TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street, "en"); - TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street, "en"); + TestBuilding building0(m2::PointD(-1.0, 0.0), "" /* name */, "0", street.GetName("en"), "en"); + TestBuilding building1(m2::PointD(1.0, 0.0), "", "1", street.GetName("en"), "en"); TestBuilding building2(m2::PointD(2.0, 0.0), "named building", "" /* house number */, "en"); TestBuilding building3(m2::PointD(3.0, 0.0), "named building", "", "en"); @@ -1397,7 +1397,7 @@ UNIT_CLASS_TEST(ProcessorTest, PathsThroughLayers) "Computing street", "en"); TestBuilding statisticalLearningBuilding(m2::PointD(8.0, 8.0), "Statistical Learning, Inc.", "0", - computingStreet, "en"); + computingStreet.GetName("en"), "en"); TestPOI reinforcementCafe(m2::PointD(8.0, 8.0), "Trattoria Reinforcemento", "en"); reinforcementCafe.SetTypes({{"amenity", "cafe"}}); @@ -1665,7 +1665,7 @@ UNIT_CLASS_TEST(ProcessorTest, SquareAsStreetTest) TestPOI nonameHouse(m2::PointD(1.0, 1.0), "", "en"); nonameHouse.SetHouseNumber("3"); - nonameHouse.SetStreetName(square.GetName()); + nonameHouse.SetStreetName(square.GetName("en")); auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { diff --git a/search/search_integration_tests/ranker_test.cpp b/search/search_integration_tests/ranker_test.cpp index 82cd89ebfc..20ecaa05b0 100644 --- a/search/search_integration_tests/ranker_test.cpp +++ b/search/search_integration_tests/ranker_test.cpp @@ -25,12 +25,12 @@ UNIT_CLASS_TEST(RankerTest, ErrorsInStreets) TestStreet mazurova( vector<m2::PointD>{m2::PointD(-0.001, -0.001), m2::PointD(0, 0), m2::PointD(0.001, 0.001)}, "Мазурова", "ru"); - TestBuilding mazurova14(m2::PointD(-0.001, -0.001), "", "14", mazurova, "ru"); + TestBuilding mazurova14(m2::PointD(-0.001, -0.001), "", "14", mazurova.GetName("ru"), "ru"); TestStreet masherova( vector<m2::PointD>{m2::PointD(-0.001, 0.001), m2::PointD(0, 0), m2::PointD(0.001, -0.001)}, "Машерова", "ru"); - TestBuilding masherova14(m2::PointD(0.001, 0.001), "", "14", masherova, "ru"); + TestBuilding masherova14(m2::PointD(0.001, 0.001), "", "14", masherova.GetName("ru"), "ru"); auto id = BuildCountry("Belarus", [&](TestMwmBuilder & builder) { builder.Add(mazurova); diff --git a/search/search_integration_tests/smoke_test.cpp b/search/search_integration_tests/smoke_test.cpp index cd0478f007..19d69e8875 100644 --- a/search/search_integration_tests/smoke_test.cpp +++ b/search/search_integration_tests/smoke_test.cpp @@ -40,8 +40,13 @@ public: fb.GetMetadata().Set(feature::Metadata::FMD_TEST_ID, strings::to_string(m_id)); fb.SetCenter(m_center); - if (!m_name.empty()) - CHECK(fb.AddName(m_lang, m_name), ("Can't set feature name:", m_name, "(", m_lang, ")")); + m_name.ForEach([&](int8_t langCode, string const & name) { + if (!name.empty()) + { + auto const lang = StringUtf8Multilang::GetLangByCode(langCode); + CHECK(fb.AddName(lang, name), ("Can't set feature name:", name, "(", lang, ")")); + } + }); auto const & classificator = classif(); fb.AddType(classificator.GetTypeByPath({"place", "country"})); @@ -284,7 +289,7 @@ UNIT_CLASS_TEST(SmokeTest, PoiWithAddress) TestStreet mainStreet({m2::PointD(0.0, 0.0), m2::PointD(1.0, 1.0), m2::PointD(2.0, 2.0)}, "Main Street", "en"); TestCafe cafe(m2::PointD(1.0, 1.0), "Starbucks", "en"); - cafe.SetStreetName(mainStreet.GetName()); + cafe.SetStreetName(mainStreet.GetName("en")); cafe.SetHouseNumber("27"); auto id = BuildMwm(kCountryName, feature::DataHeader::country, [&](TestMwmBuilder & builder) { |