Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -32,14 +32,14 @@ UNIT_TEST(ConfigLoader_Base)
// This functionality is not used and corresponding server is not working.
// Uncomment it when server will be up.
//UNIT_TEST(ConfigLoader_GetRemoteHash)
// UNIT_TEST(ConfigLoader_GetRemoteHash)
//{
// auto const hashStr = ConfigLoader::GetRemoteHash();
// TEST_NOT_EQUAL(hashStr, "", ());
// TEST_EQUAL(hashStr, ConfigLoader::GetRemoteHash(), ());
//}
//
//UNIT_TEST(ConfigLoader_GetRemoteConfig)
// UNIT_TEST(ConfigLoader_GetRemoteConfig)
//{
// pugi::xml_document doc;
// ConfigLoader::GetRemoteConfig(doc);

View File

@@ -11,19 +11,10 @@ UNIT_TEST(EditorConfig_TypeDescription)
using Fields = editor::TypeAggregatedDescription::FeatureFields;
Fields const poiInternet = {
EType::FMD_OPEN_HOURS,
EType::FMD_PHONE_NUMBER,
EType::FMD_WEBSITE,
EType::FMD_INTERNET,
EType::FMD_EMAIL,
EType::FMD_LEVEL,
EType::FMD_CONTACT_FACEBOOK,
EType::FMD_CONTACT_INSTAGRAM,
EType::FMD_CONTACT_TWITTER,
EType::FMD_CONTACT_VK,
EType::FMD_CONTACT_LINE,
EType::FMD_CONTACT_FEDIVERSE,
EType::FMD_CONTACT_BLUESKY,
EType::FMD_OPEN_HOURS, EType::FMD_PHONE_NUMBER, EType::FMD_WEBSITE, EType::FMD_INTERNET,
EType::FMD_EMAIL, EType::FMD_LEVEL, EType::FMD_CONTACT_FACEBOOK, EType::FMD_CONTACT_INSTAGRAM,
EType::FMD_CONTACT_TWITTER, EType::FMD_CONTACT_VK, EType::FMD_CONTACT_LINE, EType::FMD_CONTACT_FEDIVERSE,
EType::FMD_CONTACT_BLUESKY,
};
pugi::xml_document doc;

View File

@@ -31,10 +31,9 @@ UNIT_TEST(Notes_Smoke)
{mercator::ToLatLon({2, 2}), "Some note2"},
{mercator::ToLatLon({1, 1}), "Some note3"}};
auto const isEqual = std::equal(
result.begin(), result.end(), expected.begin(), [](Note const & lhs, Note const & rhs) {
return lhs.m_point.EqualDxDy(rhs.m_point, Notes::kTolerance);
});
auto const isEqual =
std::equal(result.begin(), result.end(), expected.begin(), [](Note const & lhs, Note const & rhs)
{ return lhs.m_point.EqualDxDy(rhs.m_point, Notes::kTolerance); });
TEST(isEqual, ());
}
}

View File

@@ -274,8 +274,7 @@ UNIT_TEST(GetBestOsmNode_Test)
TEST(osmResponse.load_buffer(osmRawResponseNode, ::strlen(osmRawResponseNode)), ());
auto const bestNode = matcher::GetBestOsmNode(osmResponse, ms::LatLon(53.8977398, 27.5579251));
TEST_EQUAL(editor::XMLFeature(bestNode).GetName(),
"Главное управление капитального строительства", ());
TEST_EQUAL(editor::XMLFeature(bestNode).GetName(), "Главное управление капитального строительства", ());
}
{
pugi::xml_document osmResponse;
@@ -292,16 +291,11 @@ UNIT_TEST(GetBestOsmWay_Test)
pugi::xml_document osmResponse;
TEST(osmResponse.load_buffer(osmRawResponseWay, ::strlen(osmRawResponseWay)), ());
std::vector<m2::PointD> const geometry = {
{27.557515856307106, 64.236609073256034},
{27.55784576801841, 64.236820967769773},
{27.557352241556003, 64.236863883114324},
{27.55784576801841, 64.236820967769773},
{27.557352241556003, 64.236863883114324},
{27.557765301747366, 64.236963124848614},
{27.557352241556003, 64.236863883114324},
{27.557765301747366, 64.236963124848614},
{27.55768215326728, 64.237078459837136}
};
{27.557515856307106, 64.236609073256034}, {27.55784576801841, 64.236820967769773},
{27.557352241556003, 64.236863883114324}, {27.55784576801841, 64.236820967769773},
{27.557352241556003, 64.236863883114324}, {27.557765301747366, 64.236963124848614},
{27.557352241556003, 64.236863883114324}, {27.557765301747366, 64.236963124848614},
{27.55768215326728, 64.237078459837136}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST(bestWay, ());
@@ -312,16 +306,11 @@ UNIT_TEST(GetBestOsmWay_Test)
TEST(osmResponse.load_buffer(osmRawResponseWay, ::strlen(osmRawResponseWay)), ());
// Each point is moved for 0.0001 on x and y. It is aboout a half of side length.
std::vector<m2::PointD> const geometry = {
{27.557615856307106, 64.236709073256034},
{27.55794576801841, 64.236920967769773},
{27.557452241556003, 64.236963883114324},
{27.55794576801841, 64.236920967769773},
{27.557452241556003, 64.236963883114324},
{27.557865301747366, 64.237063124848614},
{27.557452241556003, 64.236963883114324},
{27.557865301747366, 64.237063124848614},
{27.55778215326728, 64.237178459837136}
};
{27.557615856307106, 64.236709073256034}, {27.55794576801841, 64.236920967769773},
{27.557452241556003, 64.236963883114324}, {27.55794576801841, 64.236920967769773},
{27.557452241556003, 64.236963883114324}, {27.557865301747366, 64.237063124848614},
{27.557452241556003, 64.236963883114324}, {27.557865301747366, 64.237063124848614},
{27.55778215326728, 64.237178459837136}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST(!bestWay, ());
@@ -333,76 +322,41 @@ UNIT_TEST(GetBestOsmRealtion_Test)
pugi::xml_document osmResponse;
TEST(osmResponse.load_buffer(osmRawResponseRelation, ::strlen(osmRawResponseRelation)), ());
std::vector<m2::PointD> const geometry = {
{37.640253436865322, 67.455316241497655},
{37.64019442826654, 67.455394025559684},
{37.640749645536772, 67.455726619480004},
{37.640253436865322, 67.455316241497655},
{37.640749645536772, 67.455726619480004},
{37.64069063693799, 67.455281372780206},
{37.640253436865322, 67.455316241497655},
{37.64069063693799, 67.455281372780206},
{37.640505564514598, 67.455174084418815},
{37.640253436865322, 67.455316241497655},
{37.640505564514598, 67.455174084418815},
{37.640376818480917, 67.455053385012263},
{37.640253436865322, 67.455316241497655},
{37.640376818480917, 67.455053385012263},
{37.640320492091178, 67.454932685605684},
{37.640253436865322, 67.455316241497655},
{37.640320492091178, 67.454932685605684},
{37.640111279786453, 67.455147262328467},
{37.640111279786453, 67.455147262328467},
{37.640320492091178, 67.454932685605684},
{37.640046906769612, 67.454938050023742},
{37.640046906769612, 67.454938050023742},
{37.640320492091178, 67.454932685605684},
{37.640320492091178, 67.454811986199104},
{37.640046906769612, 67.454938050023742},
{37.640320492091178, 67.454811986199104},
{37.640105915368395, 67.454677875747365},
{37.640105915368395, 67.454677875747365},
{37.640320492091178, 67.454811986199104},
{37.64035804301767, 67.454704697837713},
{37.640105915368395, 67.454677875747365},
{37.64035804301767, 67.454704697837713},
{37.64018101722138, 67.454508896578176},
{37.64018101722138, 67.454508896578176},
{37.64035804301767, 67.454704697837713},
{37.640663814847642, 67.454390879380639},
{37.64018101722138, 67.454508896578176},
{37.640663814847642, 67.454390879380639},
{37.640489471260366, 67.454173620448813},
{37.640489471260366, 67.454173620448813},
{37.640663814847642, 67.454390879380639},
{37.640634310548251, 67.454090471968726},
{37.640634310548251, 67.454090471968726},
{37.640663814847642, 67.454390879380639},
{37.640827429598772, 67.454321141945741},
{37.640634310548251, 67.454090471968726},
{37.640827429598772, 67.454321141945741},
{37.640787196463265, 67.454063649878378},
{37.640787196463265, 67.454063649878378},
{37.640827429598772, 67.454321141945741},
{37.64095349342341, 67.454079743132581},
{37.64095349342341, 67.454079743132581},
{37.640827429598772, 67.454321141945741},
{37.641001773186048, 67.454350646245103},
{37.64095349342341, 67.454079743132581},
{37.641001773186048, 67.454350646245103},
{37.641098332711294, 67.454152162776523},
{37.641098332711294, 67.454152162776523},
{37.641001773186048, 67.454350646245103},
{37.641243171999179, 67.45453303645948},
{37.641098332711294, 67.454152162776523},
{37.641243171999179, 67.45453303645948},
{37.641618681264049, 67.454541083086582},
{37.641618681264049, 67.454541083086582},
{37.641243171999179, 67.45453303645948},
{37.64069063693799, 67.455281372780206},
{37.641618681264049, 67.454541083086582},
{37.64069063693799, 67.455281372780206},
{37.640749645536772, 67.455726619480004}
};
{37.640253436865322, 67.455316241497655}, {37.64019442826654, 67.455394025559684},
{37.640749645536772, 67.455726619480004}, {37.640253436865322, 67.455316241497655},
{37.640749645536772, 67.455726619480004}, {37.64069063693799, 67.455281372780206},
{37.640253436865322, 67.455316241497655}, {37.64069063693799, 67.455281372780206},
{37.640505564514598, 67.455174084418815}, {37.640253436865322, 67.455316241497655},
{37.640505564514598, 67.455174084418815}, {37.640376818480917, 67.455053385012263},
{37.640253436865322, 67.455316241497655}, {37.640376818480917, 67.455053385012263},
{37.640320492091178, 67.454932685605684}, {37.640253436865322, 67.455316241497655},
{37.640320492091178, 67.454932685605684}, {37.640111279786453, 67.455147262328467},
{37.640111279786453, 67.455147262328467}, {37.640320492091178, 67.454932685605684},
{37.640046906769612, 67.454938050023742}, {37.640046906769612, 67.454938050023742},
{37.640320492091178, 67.454932685605684}, {37.640320492091178, 67.454811986199104},
{37.640046906769612, 67.454938050023742}, {37.640320492091178, 67.454811986199104},
{37.640105915368395, 67.454677875747365}, {37.640105915368395, 67.454677875747365},
{37.640320492091178, 67.454811986199104}, {37.64035804301767, 67.454704697837713},
{37.640105915368395, 67.454677875747365}, {37.64035804301767, 67.454704697837713},
{37.64018101722138, 67.454508896578176}, {37.64018101722138, 67.454508896578176},
{37.64035804301767, 67.454704697837713}, {37.640663814847642, 67.454390879380639},
{37.64018101722138, 67.454508896578176}, {37.640663814847642, 67.454390879380639},
{37.640489471260366, 67.454173620448813}, {37.640489471260366, 67.454173620448813},
{37.640663814847642, 67.454390879380639}, {37.640634310548251, 67.454090471968726},
{37.640634310548251, 67.454090471968726}, {37.640663814847642, 67.454390879380639},
{37.640827429598772, 67.454321141945741}, {37.640634310548251, 67.454090471968726},
{37.640827429598772, 67.454321141945741}, {37.640787196463265, 67.454063649878378},
{37.640787196463265, 67.454063649878378}, {37.640827429598772, 67.454321141945741},
{37.64095349342341, 67.454079743132581}, {37.64095349342341, 67.454079743132581},
{37.640827429598772, 67.454321141945741}, {37.641001773186048, 67.454350646245103},
{37.64095349342341, 67.454079743132581}, {37.641001773186048, 67.454350646245103},
{37.641098332711294, 67.454152162776523}, {37.641098332711294, 67.454152162776523},
{37.641001773186048, 67.454350646245103}, {37.641243171999179, 67.45453303645948},
{37.641098332711294, 67.454152162776523}, {37.641243171999179, 67.45453303645948},
{37.641618681264049, 67.454541083086582}, {37.641618681264049, 67.454541083086582},
{37.641243171999179, 67.45453303645948}, {37.64069063693799, 67.455281372780206},
{37.641618681264049, 67.454541083086582}, {37.64069063693799, 67.455281372780206},
{37.640749645536772, 67.455726619480004}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST_EQUAL(bestWay.attribute("id").value(), std::string("365808"), ());
@@ -456,13 +410,9 @@ UNIT_TEST(HouseBuildingMiss_test)
pugi::xml_document osmResponse;
TEST(osmResponse.load_buffer(osmResponseBuildingMiss, ::strlen(osmResponseBuildingMiss)), ());
std::vector<m2::PointD> const geometry = {
{-0.2048121407986514, 60.333984198674443},
{-0.20478800091734684, 60.333909096821458},
{-0.20465925488366565, 60.334029796228037},
{-0.2048121407986514, 60.333984198674443},
{-0.20478800091734684, 60.333909096821458},
{-0.20463511500236109, 60.333954694375052}
};
{-0.2048121407986514, 60.333984198674443}, {-0.20478800091734684, 60.333909096821458},
{-0.20465925488366565, 60.334029796228037}, {-0.2048121407986514, 60.333984198674443},
{-0.20478800091734684, 60.333909096821458}, {-0.20463511500236109, 60.333954694375052}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST_EQUAL(bestWay.attribute("id").value(), std::string("345630019"), ());
@@ -512,17 +462,12 @@ std::string const kHouseWithSeveralEntrances = R"xxx("
UNIT_TEST(HouseWithSeveralEntrances)
{
pugi::xml_document osmResponse;
TEST(osmResponse.load_buffer(kHouseWithSeveralEntrances.c_str(),
kHouseWithSeveralEntrances.size()), ());
TEST(osmResponse.load_buffer(kHouseWithSeveralEntrances.c_str(), kHouseWithSeveralEntrances.size()), ());
std::vector<m2::PointD> geometry = {
{37.570076119676798, 67.574481424499169},
{37.570258509891175, 67.574527022052763},
{37.569802534355233, 67.575570401367315},
{37.570258509891175, 67.574527022052763},
{37.569802534355233, 67.575570401367315},
{37.56998492456961, 67.57561599892091}
};
{37.570076119676798, 67.574481424499169}, {37.570258509891175, 67.574527022052763},
{37.569802534355233, 67.575570401367315}, {37.570258509891175, 67.574527022052763},
{37.569802534355233, 67.575570401367315}, {37.56998492456961, 67.57561599892091}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST_EQUAL(bestWay.attribute("id").value(), std::string("30680719"), ());
@@ -565,13 +510,9 @@ UNIT_TEST(RelationWithSingleWay)
TEST(osmResponse.load_buffer(kRelationWithSingleWay.c_str(), kRelationWithSingleWay.size()), ());
std::vector<m2::PointD> geometry = {
{37.539920043497688, 67.533792313440074},
{37.539477479006933, 67.533234413960827},
{37.541207503834414, 67.532770391797811},
{37.539477479006933, 67.533234413960827},
{37.541207503834414, 67.532770391797811},
{37.54076493934366, 67.532212492318536}
};
{37.539920043497688, 67.533792313440074}, {37.539477479006933, 67.533234413960827},
{37.541207503834414, 67.532770391797811}, {37.539477479006933, 67.533234413960827},
{37.541207503834414, 67.532770391797811}, {37.54076493934366, 67.532212492318536}};
auto const bestWay = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST_EQUAL(bestWay.attribute("id").value(), std::string("26232961"), ());
@@ -579,23 +520,9 @@ UNIT_TEST(RelationWithSingleWay)
UNIT_TEST(ScoreTriangulatedGeometries)
{
std::vector<m2::PointD> lhs = {
{0, 0},
{10, 10},
{10, 0},
{0, 0},
{10, 10},
{0, 10}
};
std::vector<m2::PointD> lhs = {{0, 0}, {10, 10}, {10, 0}, {0, 0}, {10, 10}, {0, 10}};
std::vector<m2::PointD> rhs = {
{-1, -1},
{9, 9},
{9, -1},
{-1, -1},
{9, 9},
{-1, 9}
};
std::vector<m2::PointD> rhs = {{-1, -1}, {9, 9}, {9, -1}, {-1, -1}, {9, 9}, {-1, 9}};
auto const score = matcher::ScoreTriangulatedGeometries(lhs, rhs);
TEST_GREATER(score, 0.6, ());

View File

@@ -145,112 +145,59 @@ UNIT_TEST(MatchByGeometry)
// For simplification, you can visualize it as a single sequence of points
// by using, for ex. Gnuplot.
std::vector<m2::PointD> geometry = {
{37.621818614168603, 67.468231078000599},
{37.621858847304139, 67.468292768808396},
{37.621783745451154, 67.468236442418657},
{37.621783745451154, 67.468236442418657},
{37.621858847304139, 67.468292768808396},
{37.621840071840893, 67.468327637525846},
{37.621783745451154, 67.468236442418657},
{37.621840071840893, 67.468327637525846},
{37.620694768582979, 67.46837323507944},
{37.621783745451154, 67.468236442418657},
{37.620694768582979, 67.46837323507944},
{37.620887887633501, 67.46797626814228},
{37.620887887633501, 67.46797626814228},
{37.620694768582979, 67.46837323507944},
{37.620826196825703, 67.467957492679034},
{37.621783745451154, 67.468236442418657},
{37.620887887633501, 67.46797626814228},
{37.621625495118082, 67.467576618996077},
{37.621625495118082, 67.467576618996077},
{37.620887887633501, 67.46797626814228},
{37.621373367468806, 67.467496152725033},
{37.621373367468806, 67.467496152725033},
{37.620887887633501, 67.46797626814228},
{37.621365320841704, 67.467439826335323},
{37.621373367468806, 67.467496152725033},
{37.621365320841704, 67.467439826335323},
{37.621386778513994, 67.467447872962424},
{37.621783745451154, 67.468236442418657},
{37.621625495118082, 67.467576618996077},
{37.621869576140256, 67.467936035006772},
{37.621869576140256, 67.467936035006772},
{37.621625495118082, 67.467576618996077},
{37.621856165095096, 67.467691953984598},
{37.621856165095096, 67.467691953984598},
{37.621625495118082, 67.467576618996077},
{37.621966135665531, 67.467348631228134},
{37.621966135665531, 67.467348631228134},
{37.621625495118082, 67.467576618996077},
{37.621722054643357, 67.467270847166105},
{37.621966135665531, 67.467348631228134},
{37.621722054643357, 67.467270847166105},
{37.621880304976401, 67.46708309253367},
{37.621880304976401, 67.46708309253367},
{37.621722054643357, 67.467270847166105},
{37.621445787112748, 67.467185016477004},
{37.621880304976401, 67.46708309253367},
{37.621445787112748, 67.467185016477004},
{37.621236574808023, 67.466879244647032},
{37.621236574808023, 67.466879244647032},
{37.621445787112748, 67.467185016477004},
{37.621365320841704, 67.467439826335323},
{37.621236574808023, 67.466879244647032},
{37.621365320841704, 67.467439826335323},
{37.620887887633501, 67.46797626814228},
{37.621966135665531, 67.467348631228134},
{37.621880304976401, 67.46708309253367},
{37.622068059608836, 67.46738081773654},
{37.622068059608836, 67.46738081773654},
{37.621880304976401, 67.46708309253367},
{37.622121703789531, 67.466683443387467},
{37.622121703789531, 67.466683443387467},
{37.621880304976401, 67.46708309253367},
{37.622019779846227, 67.466648574670018},
{37.622068059608836, 67.46738081773654},
{37.622121703789531, 67.466683443387467},
{37.622078788444981, 67.467426415290134},
{37.621869576140256, 67.467936035006772},
{37.621856165095096, 67.467691953984598},
{37.622033190891386, 67.467748280374309},
{37.621869576140256, 67.467936035006772},
{37.622033190891386, 67.467748280374309},
{37.622041237518488, 67.467981632560367},
{37.622041237518488, 67.467981632560367},
{37.622033190891386, 67.467748280374309},
{37.62210024611727, 67.467734869329149},
{37.622041237518488, 67.467981632560367},
{37.62210024611727, 67.467734869329149},
{37.622344327139444, 67.468314226480686},
{37.622344327139444, 67.468314226480686},
{37.62210024611727, 67.467734869329149},
{37.622078788444981, 67.467426415290134},
{37.622078788444981, 67.467426415290134},
{37.62210024611727, 67.467734869329149},
{37.622060012981734, 67.46746664842567},
{37.622344327139444, 67.468314226480686},
{37.622078788444981, 67.467426415290134},
{37.622121703789531, 67.466683443387467},
{37.622041237518488, 67.467981632560367},
{37.622344327139444, 67.468314226480686},
{37.622092199490169, 67.468252535672889},
{37.622092199490169, 67.468252535672889},
{37.622344327139444, 67.468314226480686},
{37.622049284145589, 67.468392010542686},
{37.622049284145589, 67.468392010542686},
{37.622344327139444, 67.468314226480686},
{37.622188759015415, 67.468845303869585},
{37.622049284145589, 67.468392010542686},
{37.622188759015415, 67.468845303869585},
{37.621840071840893, 67.468327637525846},
{37.621840071840893, 67.468327637525846},
{37.622188759015415, 67.468845303869585},
{37.620694768582979, 67.46837323507944},
{37.622041237518488, 67.467981632560367},
{37.622092199490169, 67.468252535672889},
{37.622065377399821, 67.468244489045759}
};
{37.621818614168603, 67.468231078000599}, {37.621858847304139, 67.468292768808396},
{37.621783745451154, 67.468236442418657}, {37.621783745451154, 67.468236442418657},
{37.621858847304139, 67.468292768808396}, {37.621840071840893, 67.468327637525846},
{37.621783745451154, 67.468236442418657}, {37.621840071840893, 67.468327637525846},
{37.620694768582979, 67.46837323507944}, {37.621783745451154, 67.468236442418657},
{37.620694768582979, 67.46837323507944}, {37.620887887633501, 67.46797626814228},
{37.620887887633501, 67.46797626814228}, {37.620694768582979, 67.46837323507944},
{37.620826196825703, 67.467957492679034}, {37.621783745451154, 67.468236442418657},
{37.620887887633501, 67.46797626814228}, {37.621625495118082, 67.467576618996077},
{37.621625495118082, 67.467576618996077}, {37.620887887633501, 67.46797626814228},
{37.621373367468806, 67.467496152725033}, {37.621373367468806, 67.467496152725033},
{37.620887887633501, 67.46797626814228}, {37.621365320841704, 67.467439826335323},
{37.621373367468806, 67.467496152725033}, {37.621365320841704, 67.467439826335323},
{37.621386778513994, 67.467447872962424}, {37.621783745451154, 67.468236442418657},
{37.621625495118082, 67.467576618996077}, {37.621869576140256, 67.467936035006772},
{37.621869576140256, 67.467936035006772}, {37.621625495118082, 67.467576618996077},
{37.621856165095096, 67.467691953984598}, {37.621856165095096, 67.467691953984598},
{37.621625495118082, 67.467576618996077}, {37.621966135665531, 67.467348631228134},
{37.621966135665531, 67.467348631228134}, {37.621625495118082, 67.467576618996077},
{37.621722054643357, 67.467270847166105}, {37.621966135665531, 67.467348631228134},
{37.621722054643357, 67.467270847166105}, {37.621880304976401, 67.46708309253367},
{37.621880304976401, 67.46708309253367}, {37.621722054643357, 67.467270847166105},
{37.621445787112748, 67.467185016477004}, {37.621880304976401, 67.46708309253367},
{37.621445787112748, 67.467185016477004}, {37.621236574808023, 67.466879244647032},
{37.621236574808023, 67.466879244647032}, {37.621445787112748, 67.467185016477004},
{37.621365320841704, 67.467439826335323}, {37.621236574808023, 67.466879244647032},
{37.621365320841704, 67.467439826335323}, {37.620887887633501, 67.46797626814228},
{37.621966135665531, 67.467348631228134}, {37.621880304976401, 67.46708309253367},
{37.622068059608836, 67.46738081773654}, {37.622068059608836, 67.46738081773654},
{37.621880304976401, 67.46708309253367}, {37.622121703789531, 67.466683443387467},
{37.622121703789531, 67.466683443387467}, {37.621880304976401, 67.46708309253367},
{37.622019779846227, 67.466648574670018}, {37.622068059608836, 67.46738081773654},
{37.622121703789531, 67.466683443387467}, {37.622078788444981, 67.467426415290134},
{37.621869576140256, 67.467936035006772}, {37.621856165095096, 67.467691953984598},
{37.622033190891386, 67.467748280374309}, {37.621869576140256, 67.467936035006772},
{37.622033190891386, 67.467748280374309}, {37.622041237518488, 67.467981632560367},
{37.622041237518488, 67.467981632560367}, {37.622033190891386, 67.467748280374309},
{37.62210024611727, 67.467734869329149}, {37.622041237518488, 67.467981632560367},
{37.62210024611727, 67.467734869329149}, {37.622344327139444, 67.468314226480686},
{37.622344327139444, 67.468314226480686}, {37.62210024611727, 67.467734869329149},
{37.622078788444981, 67.467426415290134}, {37.622078788444981, 67.467426415290134},
{37.62210024611727, 67.467734869329149}, {37.622060012981734, 67.46746664842567},
{37.622344327139444, 67.468314226480686}, {37.622078788444981, 67.467426415290134},
{37.622121703789531, 67.466683443387467}, {37.622041237518488, 67.467981632560367},
{37.622344327139444, 67.468314226480686}, {37.622092199490169, 67.468252535672889},
{37.622092199490169, 67.468252535672889}, {37.622344327139444, 67.468314226480686},
{37.622049284145589, 67.468392010542686}, {37.622049284145589, 67.468392010542686},
{37.622344327139444, 67.468314226480686}, {37.622188759015415, 67.468845303869585},
{37.622049284145589, 67.468392010542686}, {37.622188759015415, 67.468845303869585},
{37.621840071840893, 67.468327637525846}, {37.621840071840893, 67.468327637525846},
{37.622188759015415, 67.468845303869585}, {37.620694768582979, 67.46837323507944},
{37.622041237518488, 67.467981632560367}, {37.622092199490169, 67.468252535672889},
{37.622065377399821, 67.468244489045759}};
auto const matched = matcher::GetBestOsmWayOrRelation(osmResponse, geometry);
TEST_EQUAL(matched.attribute("id").value(), std::string("85761"), ());

View File

@@ -29,7 +29,8 @@ UNIT_TEST(NewFeatureCategories_UniqueNames)
do
{
LOG(LWARNING, (*result));
} while (++result != names.end());
}
while (++result != names.end());
TEST(false, ("Please look at output above"));
}

View File

@@ -186,8 +186,8 @@ UNIT_TEST(TestAppendTimeTable)
TEST(tt.Commit(), ());
TEST(tts.Append(tts.GetComplementTimeTable()), ());
TEST_EQUAL(tts.Back().GetOpeningDays(), (std::set<osmoh::Weekday>{osmoh::Weekday::Sunday,
osmoh::Weekday::Saturday}), ());
TEST_EQUAL(tts.Back().GetOpeningDays(),
(std::set<osmoh::Weekday>{osmoh::Weekday::Sunday, osmoh::Weekday::Saturday}), ());
}
{
@@ -198,8 +198,8 @@ UNIT_TEST(TestAppendTimeTable)
}
TEST(tts.Append(tts.GetComplementTimeTable()), ());
TEST_EQUAL(tts.Back().GetOpeningDays(), (std::set<osmoh::Weekday>{osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday}), ());
TEST_EQUAL(tts.Back().GetOpeningDays(), (std::set<osmoh::Weekday>{osmoh::Weekday::Monday, osmoh::Weekday::Tuesday}),
());
TEST(!tts.GetComplementTimeTable().IsValid(), ());
TEST(!tts.Append(tts.GetComplementTimeTable()), ());
@@ -208,11 +208,10 @@ UNIT_TEST(TestAppendTimeTable)
TEST(tts.Remove(0), ());
TEST(tts.Remove(1), ());
TEST_EQUAL(tts.Size(), 1, ());
TEST_EQUAL(tts.GetUnhandledDays(), (std::set<osmoh::Weekday>{osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday}), ());
TEST_EQUAL(tts.GetUnhandledDays(),
(std::set<osmoh::Weekday>{osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
());
}
{
TimeTableSet tts;

View File

@@ -38,7 +38,7 @@ class IsCafeChecker : public ftypes::BaseChecker
public:
static IsCafeChecker const & Instance()
{
static const IsCafeChecker instance;
static IsCafeChecker const instance;
return instance;
}
@@ -53,8 +53,7 @@ private:
class TestCafe : public TestPOI
{
public:
TestCafe(m2::PointD const & center, std::string const & name, std::string const & lang)
: TestPOI(center, name, lang)
TestCafe(m2::PointD const & center, std::string const & name, std::string const & lang) : TestPOI(center, name, lang)
{
SetTypes({{"amenity", "cafe"}});
}
@@ -63,10 +62,7 @@ public:
class OptionalSaveStorage : public editor::InMemoryStorage
{
public:
void AllowSave(bool allow)
{
m_allowSave = allow;
}
void AllowSave(bool allow) { m_allowSave = allow; }
// StorageBase overrides:
bool Save(pugi::xml_document const & doc) override
@@ -104,10 +100,7 @@ public:
editor.SetStorageForTesting(std::make_unique<editor::InMemoryStorage>());
}
void AllowSave(bool allow)
{
m_storage->AllowSave(allow);
}
void AllowSave(bool allow) { m_storage->AllowSave(allow); }
private:
OptionalSaveStorage * m_storage = new OptionalSaveStorage;
@@ -121,9 +114,7 @@ void ForEachCafeAtPoint(DataSource & dataSource, m2::PointD const & mercator, Fn
auto const f = [&fn](FeatureType & ft)
{
if (IsCafeChecker::Instance()(ft))
{
fn(ft);
}
};
dataSource.ForEachInRect(f, rect, scales::GetUpperScale());
@@ -143,13 +134,10 @@ void SetBuildingLevels(osm::EditableMapObject & emo, std::string s)
void SetBuildingLevelsToOne(FeatureType & ft)
{
EditFeature(ft, [](osm::EditableMapObject & emo)
{
SetBuildingLevels(emo, "1");
});
EditFeature(ft, [](osm::EditableMapObject & emo) { SetBuildingLevels(emo, "1"); });
}
void CreateCafeAtPoint(m2::PointD const & point, MwmSet::MwmId const & mwmId, osm::EditableMapObject &emo)
void CreateCafeAtPoint(m2::PointD const & point, MwmSet::MwmId const & mwmId, osm::EditableMapObject & emo)
{
auto & editor = osm::Editor::Instance();
@@ -158,9 +146,7 @@ void CreateCafeAtPoint(m2::PointD const & point, MwmSet::MwmId const & mwmId, os
TEST_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ());
}
void GenerateUploadedFeature(MwmSet::MwmId const & mwmId,
osm::EditableMapObject const & emo,
pugi::xml_document & out)
void GenerateUploadedFeature(MwmSet::MwmId const & mwmId, osm::EditableMapObject const & emo, pugi::xml_document & out)
{
pugi::xml_node root = out.append_child("comaps");
root.append_attribute("format_version") = 1;
@@ -266,7 +252,8 @@ void EditorTest::GetEditedFeatureTest()
builder.Add(cafe);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft) {
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
TEST(!editor.GetEditedFeature(ft.GetID()), ());
SetBuildingLevelsToOne(ft);
@@ -305,7 +292,8 @@ void EditorTest::SetIndexTest()
osm::EditableMapObject emo;
CreateCafeAtPoint({2.0, 2.0}, gbMwmId, emo);
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft) {
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
auto const firstPtr = editor.GetOriginalMapObject(ft.GetID());
TEST(firstPtr, ());
SetBuildingLevelsToOne(ft);
@@ -314,7 +302,8 @@ void EditorTest::SetIndexTest()
TEST_EQUAL(firstPtr->GetID(), secondPtr->GetID(), ());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft) {
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
TEST_EQUAL(editor.GetOriginalFeatureStreet(ft.GetID()), "Test street", ());
EditFeature(ft, [](osm::EditableMapObject & emo)
@@ -326,34 +315,22 @@ void EditorTest::SetIndexTest()
});
uint32_t counter = 0;
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft)
{
++counter;
}, {100.0, 100.0});
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft) { ++counter; }, {100.0, 100.0});
TEST_EQUAL(counter, 0, ());
counter = 0;
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft)
{
++counter;
}, {3.0, 3.0});
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft) { ++counter; }, {3.0, 3.0});
TEST_EQUAL(counter, 1, ());
counter = 0;
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft)
{
++counter;
}, {1.0, 1.0});
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft) { ++counter; }, {1.0, 1.0});
TEST_EQUAL(counter, 2, ());
counter = 0;
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft)
{
++counter;
}, {4.0, 4.0});
editor.ForEachFeatureAtPoint([&counter](FeatureType & ft) { ++counter; }, {4.0, 4.0});
TEST_EQUAL(counter, 3, ());
}
@@ -380,10 +357,7 @@ void EditorTest::GetEditedFeatureStreetTest()
TEST(!editor.GetEditedFeatureStreet(ft.GetID(), street), ());
osm::LocalizedStreet ls{"some street", ""};
EditFeature(ft, [&ls](osm::EditableMapObject & emo)
{
emo.SetStreet(ls);
});
EditFeature(ft, [&ls](osm::EditableMapObject & emo) { emo.SetStreet(ls); });
TEST(editor.GetEditedFeatureStreet(ft.GetID(), street), ());
TEST_EQUAL(street, ls.m_defaultName, ());
@@ -443,9 +417,7 @@ void EditorTest::IsFeatureUploadedTest()
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
TEST(!editor.IsFeatureUploaded(ft.GetID().m_mwmId, ft.GetID().m_index), ());
});
{ TEST(!editor.IsFeatureUploaded(ft.GetID().m_mwmId, ft.GetID().m_index), ()); });
osm::EditableMapObject emo;
CreateCafeAtPoint({3.0, 3.0}, mwmId, emo);
@@ -592,20 +564,12 @@ void EditorTest::OnMapDeregisteredTest()
builder.Add(cafeMoscow);
});
auto nzMwmId = BuildMwm("NZ", [](TestMwmBuilder & builder)
{
});
auto nzMwmId = BuildMwm("NZ", [](TestMwmBuilder & builder) {});
m_dataSource.DeregisterMap(nzMwmId.GetInfo()->GetLocalFile().GetCountryFile());
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
TEST_EQUAL(editor.m_features.Get()->size(), 2, (editor.m_features.Get()->size()));
@@ -669,20 +633,14 @@ void EditorTest::RollBackChangesTest()
TEST_EQUAL(editor.SaveEditedFeature(emo), osm::Editor::SaveResult::SavedSuccessfully, ());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&houseNumber](FeatureType & ft)
{
TEST_EQUAL(ft.GetHouseNumber(), houseNumber, ());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[&houseNumber](FeatureType & ft) { TEST_EQUAL(ft.GetHouseNumber(), houseNumber, ()); });
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
editor.RollBackChanges(ft.GetID());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[&editor](FeatureType & ft) { editor.RollBackChanges(ft.GetID()); });
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
TEST_EQUAL(ft.GetHouseNumber(), "", ());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[](FeatureType & ft) { TEST_EQUAL(ft.GetHouseNumber(), "", ()); });
}
void EditorTest::HaveMapEditsOrNotesToUploadTest()
@@ -697,10 +655,7 @@ void EditorTest::HaveMapEditsOrNotesToUploadTest()
TEST(!editor.HaveMapEditsOrNotesToUpload(), ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
TEST(editor.HaveMapEditsOrNotesToUpload(), ());
editor.ClearAllLocalEdits();
@@ -715,8 +670,7 @@ void EditorTest::HaveMapEditsOrNotesToUploadTest()
using NoteType = osm::Editor::NoteProblemType;
feature::TypesHolder typesHolder;
std::string defaultName;
editor.CreateNote({1.0, 1.0}, ft.GetID(), typesHolder, defaultName, NoteType::PlaceDoesNotExist,
"exploded");
editor.CreateNote({1.0, 1.0}, ft.GetID(), typesHolder, defaultName, NoteType::PlaceDoesNotExist, "exploded");
});
TEST(editor.HaveMapEditsOrNotesToUpload(), ());
@@ -741,18 +695,12 @@ void EditorTest::HaveMapEditsToUploadTest()
TEST(!editor.HaveMapEditsToUpload(gbMwmId), ());
TEST(!editor.HaveMapEditsToUpload(rfMwmId), ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
TEST(editor.HaveMapEditsToUpload(gbMwmId), ());
TEST(!editor.HaveMapEditsToUpload(rfMwmId), ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(2.0, 2.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
TEST(editor.HaveMapEditsToUpload(gbMwmId), ());
TEST(editor.HaveMapEditsToUpload(rfMwmId), ());
@@ -779,26 +727,17 @@ void EditorTest::GetStatsTest()
TEST_EQUAL(stats.m_uploadedCount, 0, ());
TEST_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
stats = editor.GetStats();
TEST_EQUAL(stats.m_edits.size(), 1, ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(4.0, 4.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(4.0, 4.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
stats = editor.GetStats();
TEST_EQUAL(stats.m_edits.size(), 2, ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(5.0, 5.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(5.0, 5.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
stats = editor.GetStats();
TEST_EQUAL(stats.m_edits.size(), 3, ());
@@ -910,8 +849,9 @@ void EditorTest::CreateNoteTest()
builder.Add(TestCafe(m2::PointD(2.0, 2.0), "Cafe", "en"));
});
auto const createAndCheckNote = [&editor](FeatureID const & fId, ms::LatLon const & pos,
osm::Editor::NoteProblemType const noteType) {
auto const createAndCheckNote =
[&editor](FeatureID const & fId, ms::LatLon const & pos, osm::Editor::NoteProblemType const noteType)
{
ScopedFile sf("test_notes.xml", ScopedFile::Mode::DoNotCreate);
editor.m_notes = Notes::MakeNotes(sf.GetFullPath(), true);
feature::TypesHolder holder;
@@ -1022,12 +962,8 @@ void EditorTest::LoadMapEditsTest()
{
loadedFeatures.clear();
for (auto const & mwm : *(editor.m_features.Get()))
{
for (auto const & index : mwm.second)
{
loadedFeatures.emplace_back(index.second.m_object.GetID());
}
}
};
std::vector<FeatureID> loadedFeatures;
@@ -1142,20 +1078,12 @@ void EditorTest::SaveTransactionTest()
builder.Add(TestPOI(m2::PointD(6.0, 6.0), "Corner Post", "default"));
});
auto const rfMwmId = BuildMwm("RF", [](TestMwmBuilder & builder)
{
builder.Add(TestCafe(m2::PointD(10.0, 10.0), "Moscow Cafe1", "en"));
});
auto const rfMwmId = BuildMwm(
"RF", [](TestMwmBuilder & builder) { builder.Add(TestCafe(m2::PointD(10.0, 10.0), "Moscow Cafe1", "en")); });
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
ForEachCafeAtPoint(m_dataSource, m2::PointD(10.0, 10.0), [](FeatureType & ft)
{
SetBuildingLevelsToOne(ft);
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(10.0, 10.0), [](FeatureType & ft) { SetBuildingLevelsToOne(ft); });
auto const features = editor.m_features.Get();
@@ -1215,10 +1143,8 @@ void EditorTest::SaveTransactionTest()
}
{
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
editor.DeleteFeature(ft.GetID());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[&editor](FeatureType & ft) { editor.DeleteFeature(ft.GetID()); });
auto const features = editor.m_features.Get();
auto const mwmIt = features->find(mwmId);
@@ -1231,10 +1157,8 @@ void EditorTest::SaveTransactionTest()
}
{
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
editor.MarkFeatureAsObsolete(ft.GetID());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[&editor](FeatureType & ft) { editor.MarkFeatureAsObsolete(ft.GetID()); });
auto const features = editor.m_features.Get();
auto const mwmIt = features->find(mwmId);
@@ -1252,8 +1176,7 @@ void EditorTest::SaveTransactionTest()
using NoteType = osm::Editor::NoteProblemType;
feature::TypesHolder typesHolder;
std::string defaultName;
editor.CreateNote({1.0, 1.0}, ft.GetID(), typesHolder, defaultName, NoteType::PlaceDoesNotExist,
"exploded");
editor.CreateNote({1.0, 1.0}, ft.GetID(), typesHolder, defaultName, NoteType::PlaceDoesNotExist, "exploded");
});
TEST_EQUAL(editor.m_notes->NotUploadedNotesCount(), 0, ());
@@ -1269,10 +1192,8 @@ void EditorTest::SaveTransactionTest()
}
{
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
{
editor.RollBackChanges(ft.GetID());
});
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0),
[&editor](FeatureType & ft) { editor.RollBackChanges(ft.GetID()); });
auto const features = editor.m_features.Get();
auto const mwmIt = features->find(mwmId);
@@ -1349,9 +1270,7 @@ void EditorTest::LoadExistingEditsXml()
</mapsme>
)";
ConstructTestMwm([](editor::testing::TestMwmBuilder &)
{
});
ConstructTestMwm([](editor::testing::TestMwmBuilder &) {});
pugi::xml_document doc;
TEST(doc.load_string(data), ());
@@ -1458,14 +1377,23 @@ UNIT_CLASS_TEST(EditorTest, CreateNoteTest)
EditorTest::CreateNoteTest();
}
UNIT_CLASS_TEST(EditorTest, LoadMapEditsTest) { EditorTest::LoadMapEditsTest(); }
UNIT_CLASS_TEST(EditorTest, LoadMapEditsTest)
{
EditorTest::LoadMapEditsTest();
}
UNIT_CLASS_TEST(EditorTest, SaveEditedFeatureTest)
{
EditorTest::SaveEditedFeatureTest();
}
UNIT_CLASS_TEST(EditorTest, SaveTransactionTest) { EditorTest::SaveTransactionTest(); }
UNIT_CLASS_TEST(EditorTest, SaveTransactionTest)
{
EditorTest::SaveTransactionTest();
}
UNIT_CLASS_TEST(EditorTest, LoadEditsXml) { LoadExistingEditsXml(); }
UNIT_CLASS_TEST(EditorTest, LoadEditsXml)
{
LoadExistingEditsXml();
}
} // namespace

View File

@@ -42,8 +42,9 @@ UNIT_TEST(OpeningHours2TimeTableSet)
TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 23, ());
}
{
OpeningHours oh("Mo-Su 12:00-15:30, 19:30-23:00;"
"Fr-Sa 12:00-15:30, 19:30-23:30;");
OpeningHours oh(
"Mo-Su 12:00-15:30, 19:30-23:00;"
"Fr-Sa 12:00-15:30, 19:30-23:30;");
TEST(oh.IsValid(), ());
TimeTableSet tts;
@@ -266,12 +267,9 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
TEST(MakeTimeTableSet(oh, tts), ());
TEST_EQUAL(tts.GetUnhandledDays(),
OpeningDays({osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday,
osmoh::Weekday::Saturday}), ());
OpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday, osmoh::Weekday::Saturday}),
());
}
{
OpeningHours oh("Mo-Su 08:00-13:00,14:00-20:00; Sa 10:00-11:00 off");
@@ -329,11 +327,9 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
TEST_EQUAL(tts.Size(), 1, ());
TEST_EQUAL(tts.GetUnhandledDays(),
OpeningDays({osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday}), ());
OpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
());
}
{
OpeningHours oh("Mo-Fr 11:00-17:00; Sa-Su 12:00-16:00; Mo-Fr 11:00-13:00 off");
@@ -396,14 +392,10 @@ UNIT_TEST(TimeTableSt2OpeningHours)
{
TimeTableSet tts;
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday,
osmoh::Weekday::Saturday,
osmoh::Weekday::Sunday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday, osmoh::Weekday::Saturday,
osmoh::Weekday::Sunday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 22_h}), ());
@@ -414,12 +406,9 @@ UNIT_TEST(TimeTableSt2OpeningHours)
{
TimeTableSet tts;
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 22_h}), ());
@@ -431,12 +420,9 @@ UNIT_TEST(TimeTableSt2OpeningHours)
TimeTableSet tts;
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 22_h}), ());
@@ -449,12 +435,9 @@ UNIT_TEST(TimeTableSt2OpeningHours)
TimeTableSet tts;
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 22_h}), ());
@@ -469,10 +452,7 @@ UNIT_TEST(TimeTableSt2OpeningHours)
{
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday, osmoh::Weekday::Thursday}), ());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 10_h}), ());
@@ -480,11 +460,9 @@ UNIT_TEST(TimeTableSt2OpeningHours)
}
{
TimeTable tt = TimeTable::GetUninitializedTimeTable();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Friday,
osmoh::Weekday::Saturday,
osmoh::Weekday::Sunday}), ());
TEST(tt.SetOpeningDays(
{osmoh::Weekday::Monday, osmoh::Weekday::Friday, osmoh::Weekday::Saturday, osmoh::Weekday::Sunday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({13_h, 22_h}), ());
@@ -498,10 +476,7 @@ UNIT_TEST(TimeTableSt2OpeningHours)
{
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Friday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Wednesday, osmoh::Weekday::Friday}), ());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 10_h}), ());
@@ -509,9 +484,7 @@ UNIT_TEST(TimeTableSt2OpeningHours)
}
{
TimeTable tt = TimeTable::GetUninitializedTimeTable();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Saturday,
osmoh::Weekday::Sunday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Saturday, osmoh::Weekday::Sunday}), ());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({13_h, 22_h}), ());
@@ -524,14 +497,10 @@ UNIT_TEST(TimeTableSt2OpeningHours)
TimeTableSet tts;
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Sunday,
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday,
osmoh::Weekday::Saturday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Sunday, osmoh::Weekday::Monday, osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday, osmoh::Weekday::Thursday, osmoh::Weekday::Friday,
osmoh::Weekday::Saturday}),
());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({11_h, 24_h}), ());
@@ -544,11 +513,7 @@ UNIT_TEST(TimeTableSt2OpeningHours)
{
auto tt = tts.Front();
TEST(tt.SetOpeningDays({
osmoh::Weekday::Monday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday}), ());
TEST(tt.SetOpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Wednesday, osmoh::Weekday::Thursday}), ());
tt.SetTwentyFourHours(false);
TEST(tt.SetOpeningTime({8_h, 20_h}), ());
@@ -567,6 +532,7 @@ UNIT_TEST(TimeTableSt2OpeningHours)
TEST_EQUAL(ToString(MakeOpeningHours(tts)),
"Mo, We-Th 08:00-13:00, 14:00-20:00; "
"Sa 09:00-13:00, 14:00-18:00", ());
"Sa 09:00-13:00, 14:00-18:00",
());
}
}

View File

@@ -47,7 +47,6 @@ UNIT_TEST(XMLFeature_RawGetSet)
TEST_EQUAL(expected, sstr.str(), ());
}
UNIT_TEST(XMLFeature_Setters)
{
XMLFeature feature(XMLFeature::Type::Node);
@@ -163,7 +162,7 @@ UNIT_TEST(XMLFeature_HasTags)
UNIT_TEST(XMLFeature_FromXml)
{
// Do not space-align this string literal constant. It will be compared below.
auto const kTestNode = R"(<?xml version="1.0"?>
auto const kTestNode = R"(<?xml version="1.0"?>
<node lat="55.7978998" lon="37.474528" timestamp="2015-11-27T21:13:32Z">
<tag k="name" v="Gorki Park" />
<tag k="name:en" v="Gorki Park" />
@@ -176,11 +175,7 @@ auto const kTestNode = R"(<?xml version="1.0"?>
)";
std::map<std::string_view, std::string_view> kTestNames{
{"default", "Gorki Park"},
{"en", "Gorki Park"},
{"ru", "Парк Горького"},
{"int_name", "Gorky Park"}
};
{"default", "Gorki Park"}, {"en", "Gorki Park"}, {"ru", "Парк Горького"}, {"int_name", "Gorky Park"}};
XMLFeature feature(kTestNode);
@@ -207,10 +202,7 @@ auto const kTestNode = R"(<?xml version="1.0"?>
TEST_EQUAL(base::TimestampToString(feature.GetModificationTime()), "2015-11-27T21:13:32Z", ());
std::map<std::string_view, std::string_view> names;
feature.ForEachName([&names](std::string_view lang, std::string_view name)
{
names.emplace(lang, name);
});
feature.ForEachName([&names](std::string_view lang, std::string_view name) { names.emplace(lang, name); });
TEST_EQUAL(names, kTestNames, ());
}
@@ -266,16 +258,9 @@ UNIT_TEST(XMLFeature_FromXmlNode)
UNIT_TEST(XMLFeature_Geometry)
{
std::vector<m2::PointD> const geometry =
{
{28.7206411, 3.7182409},
{46.7569003, 47.0774689},
{22.5909217, 41.6994874},
{14.7537008, 17.7788229},
{55.1261701, 10.3199476},
{28.6519654, 50.0305930},
{28.7206411, 3.7182409}
};
std::vector<m2::PointD> const geometry = {
{28.7206411, 3.7182409}, {46.7569003, 47.0774689}, {22.5909217, 41.6994874}, {14.7537008, 17.7788229},
{55.1261701, 10.3199476}, {28.6519654, 50.0305930}, {28.7206411, 3.7182409}};
XMLFeature feature(XMLFeature::Type::Way);
feature.SetGeometry(geometry);
@@ -502,13 +487,15 @@ UNIT_TEST(XMLFeature_SocialContactsProcessing)
auto convertedFt = editor::ToXML(emo, true);
TEST(convertedFt.HasTag("contact:facebook"), ());
TEST_EQUAL(convertedFt.GetTagValue("contact:facebook"), "https://facebook.com/pages/Stereo-Plaza/118100041593935", ());
TEST_EQUAL(convertedFt.GetTagValue("contact:facebook"), "https://facebook.com/pages/Stereo-Plaza/118100041593935",
());
TEST(convertedFt.HasTag("contact:instagram"), ());
TEST_EQUAL(convertedFt.GetTagValue("contact:instagram"), "https://instagram.com/p/CSy87IhMhfm", ());
TEST(convertedFt.HasTag("contact:line"), ());
TEST_EQUAL(convertedFt.GetTagValue("contact:line"), "https://liff.line.me/1645278921-kWRPP32q/?accountId=673watcr", ());
TEST_EQUAL(convertedFt.GetTagValue("contact:line"), "https://liff.line.me/1645278921-kWRPP32q/?accountId=673watcr",
());
}
}