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

@@ -1,7 +1,7 @@
#include "testing/testing.hpp"
#include "generator/generator_tests_support/test_generator.hpp"
#include "generator/descriptions_section_builder.hpp"
#include "generator/generator_tests_support/test_generator.hpp"
#include "search/cities_boundaries_table.hpp"
#include "search/house_to_street_table.hpp"
@@ -43,7 +43,7 @@ UNIT_CLASS_TEST(TestRawGenerator, Towns)
ForEachFB(mwmName, [&](feature::FeatureBuilder const & fb)
{
++count;
//LOG(LINFO, (fb));
// LOG(LINFO, (fb));
TEST(!fb.HasType(cityType), ());
@@ -69,7 +69,7 @@ UNIT_CLASS_TEST(TestRawGenerator, Towns)
// Prepare features data source.
FrozenDataSource dataSource;
std::vector<MwmSet::MwmId> mwmIDs;
for (auto const & name : { mwmName, mwmWorld })
for (auto const & name : {mwmName, mwmWorld})
{
BuildFeatures(name);
BuildSearch(name);
@@ -123,15 +123,13 @@ UNIT_CLASS_TEST(TestRawGenerator, HighwayLinks)
auto const fid2osm = LoadFID2OsmID(mwmName);
using namespace routing;
MaxspeedType from120 = 104; // like SpeedMacro::Speed104KmPH
MaxspeedType from120 = 104; // like SpeedMacro::Speed104KmPH
std::unordered_map<uint64_t, uint16_t> osmID2Speed = {
{ 23011515, from120 }, { 23011492, from120 }, { 10689329, from120 }, { 371581901, from120 },
{ 1017695671, from120 }, { 577365212, from120 }, { 23011612, from120 }, { 1017695670, from120 },
{ 304871606, from120 }, { 1017695669, from120 }, { 577365213, from120 }, { 369541035, from120 },
{ 1014336646, from120 }, { 466365947, from120 }, { 23011511, from120 }
};
{23011515, from120}, {23011492, from120}, {10689329, from120}, {371581901, from120}, {1017695671, from120},
{577365212, from120}, {23011612, from120}, {1017695670, from120}, {304871606, from120}, {1017695669, from120},
{577365213, from120}, {369541035, from120}, {1014336646, from120}, {466365947, from120}, {23011511, from120}};
/// @todo Actually, better to assign speed for this way too.
std::unordered_set<uint64_t> osmNoSpeed = { 23691193, 1017695668 };
std::unordered_set<uint64_t> osmNoSpeed = {23691193, 1017695668};
FrozenDataSource dataSource;
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(GetMwmPath(mwmName)));
@@ -296,7 +294,7 @@ UNIT_CLASS_TEST(TestRawGenerator, Place_Region)
worldRegions = 0;
// Prepare features data source.
for (auto const & name : { mwmName, worldMwmName })
for (auto const & name : {mwmName, worldMwmName})
{
BuildFeatures(name);
BuildSearch(name);
@@ -391,7 +389,7 @@ std::string_view GetPostcode(FeatureType & ft)
{
return ft.GetMetadata(feature::Metadata::FMD_POSTCODE);
}
} // namespace
} // namespace
UNIT_CLASS_TEST(TestRawGenerator, Postcode_Relations)
{
@@ -477,15 +475,15 @@ UNIT_TEST(Relation_Wiki)
std::string const mwmName = "Relation";
std::string const arrFiles[] = {
"./data/test_data/osm/village_relation.osm",
"./data/test_data/osm/novenkoe_village.osm",
"./data/test_data/osm/nikolaevka_village.osm",
"./data/test_data/osm/village_relation.osm",
"./data/test_data/osm/novenkoe_village.osm",
"./data/test_data/osm/nikolaevka_village.osm",
};
std::string const arrWiki[] = {
"fr:Charmois-l'Orgueilleux",
"ru:Новенькое (Локтевский район)",
"ru:Николаевка (Локтевский район)",
"fr:Charmois-l'Orgueilleux",
"ru:Новенькое (Локтевский район)",
"ru:Николаевка (Локтевский район)",
};
for (size_t i = 0; i < std::size(arrFiles); ++i)
@@ -564,56 +562,51 @@ UNIT_TEST(Place_CityRelations)
std::string const worldMwmName = WORLD_FILE_NAME;
std::string const arrFiles[] = {
// 1 Relation with many polygons + 1 Node.
"./data/test_data/osm/gorlovka_city.osm",
// 2 Relations + 1 Node
"./data/test_data/osm/tver_city.osm",
// 1 Relation + 1 Node with _different_ names.
"./data/test_data/osm/reykjavik_city.osm",
"./data/test_data/osm/berlin_city.osm",
// Relation boundary is place=suburb, but border_type=city
"./data/test_data/osm/riviera_beach_city.osm",
"./data/test_data/osm/hotchkiss_town.osm",
"./data/test_data/osm/voronezh_city.osm",
"./data/test_data/osm/minsk_city.osm",
// 1 Relation with many polygons + 1 Node.
"./data/test_data/osm/gorlovka_city.osm",
// 2 Relations + 1 Node
"./data/test_data/osm/tver_city.osm",
// 1 Relation + 1 Node with _different_ names.
"./data/test_data/osm/reykjavik_city.osm", "./data/test_data/osm/berlin_city.osm",
// Relation boundary is place=suburb, but border_type=city
"./data/test_data/osm/riviera_beach_city.osm", "./data/test_data/osm/hotchkiss_town.osm",
"./data/test_data/osm/voronezh_city.osm", "./data/test_data/osm/minsk_city.osm",
// 1 boundary-only Relation + 1 Node
"./data/test_data/osm/kadikoy_town.osm",
// 2 Relations + 1 Node
"./data/test_data/osm/stolbtcy_town.osm",
// 1 Way + 1 Relation + 1 Node
"./data/test_data/osm/dmitrov_town.osm",
"./data/test_data/osm/lesnoy_town.osm",
// 1 boundary-only Relation + 1 Node
"./data/test_data/osm/kadikoy_town.osm",
// 2 Relations + 1 Node
"./data/test_data/osm/stolbtcy_town.osm",
// 1 Way + 1 Relation + 1 Node
"./data/test_data/osm/dmitrov_town.osm", "./data/test_data/osm/lesnoy_town.osm",
"./data/test_data/osm/pushkino_city.osm",
"./data/test_data/osm/korday_town.osm",
"./data/test_data/osm/bad_neustadt_town.osm",
"./data/test_data/osm/pushkino_city.osm", "./data/test_data/osm/korday_town.osm",
"./data/test_data/osm/bad_neustadt_town.osm",
/// @todo We don't store villages in World now, but for the future!
// 1 Relation + 1 Node (not linked with each other)
//"./data/test_data/osm/palm_beach_village.osm",
/// @todo We don't store villages in World now, but for the future!
// 1 Relation + 1 Node (not linked with each other)
//"./data/test_data/osm/palm_beach_village.osm",
};
ms::LatLon arrNotInBoundary[] = {
{48.2071448, 37.9729054}, // gorlovka
{56.9118261, 36.2258988}, // tver
{64.0469397, -21.9772409}, // reykjavik
{52.4013879, 13.0601531}, // berlin
{26.7481191, -80.0836532}, // riviera beach
{38.7981690, -107.7347750}, // hotchkiss
{51.7505379, 39.5894547}, // voronezh
{53.9170050, 27.8576710}, // minsk
{48.2071448, 37.9729054}, // gorlovka
{56.9118261, 36.2258988}, // tver
{64.0469397, -21.9772409}, // reykjavik
{52.4013879, 13.0601531}, // berlin
{26.7481191, -80.0836532}, // riviera beach
{38.7981690, -107.7347750}, // hotchkiss
{51.7505379, 39.5894547}, // voronezh
{53.9170050, 27.8576710}, // minsk
{41.0150982, 29.0213844}, // kadikoy
{53.5086454, 26.6979711}, // stolbtcy
{56.3752679, 37.3288391}, // dmitrov
{54.0026933, 27.6356912}, // lesnoy
{41.0150982, 29.0213844}, // kadikoy
{53.5086454, 26.6979711}, // stolbtcy
{56.3752679, 37.3288391}, // dmitrov
{54.0026933, 27.6356912}, // lesnoy
{56.0807652, 37.9277319}, // pushkino
{43.2347760, 74.7573240}, // korday
{50.4006992, 10.2020744}, // bad_neustadt
{56.0807652, 37.9277319}, // pushkino
{43.2347760, 74.7573240}, // korday
{50.4006992, 10.2020744}, // bad_neustadt
//{26.6757006, -80.0547346}, // palm beach
//{26.6757006, -80.0547346}, // palm beach
};
size_t constexpr kManyBoundriesUpperIndex = 8;
@@ -659,7 +652,8 @@ UNIT_TEST(Place_CityRelations)
// Check that we have valid boundary in World.
FrozenDataSource dataSource;
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
auto const res =
dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
TEST_EQUAL(res.second, MwmSet::RegResult::Success, ());
search::CitiesBoundariesTable table(dataSource);
@@ -700,11 +694,11 @@ UNIT_TEST(Place_CityRelations_IncludePoint)
std::string const worldMwmName = WORLD_FILE_NAME;
std::string const arrFiles[] = {
"./data/test_data/osm/valentin_alsina_town.osm",
"./data/test_data/osm/valentin_alsina_town.osm",
};
ms::LatLon arrInBoundary[] = {
{-34.6699107, -58.4302163}, // valentin_alsina
{-34.6699107, -58.4302163}, // valentin_alsina
};
for (size_t i = 0; i < std::size(arrFiles); ++i)
@@ -734,7 +728,8 @@ UNIT_TEST(Place_CityRelations_IncludePoint)
// Check that we have valid boundary in World.
FrozenDataSource dataSource;
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
auto const res =
dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
TEST_EQUAL(res.second, MwmSet::RegResult::Success, ());
search::CitiesBoundariesTable table(dataSource);
@@ -779,9 +774,9 @@ UNIT_CLASS_TEST(TestRawGenerator, Place_NoCityBoundaries)
TestDataSample const arrInput[] = {
// Check that we have only 2 cities without duplicates (Pargas, Қордай).
// Boundaries are removed because of "very big".
{ "./data/test_data/osm/no_boundary_towns.osm", 2, 2 },
{"./data/test_data/osm/no_boundary_towns.osm", 2, 2},
// 3 villages in country and 0 in World.
{ "./data/test_data/osm/us_villages_like_towns.osm", 0, 3 },
{"./data/test_data/osm/us_villages_like_towns.osm", 0, 3},
};
for (size_t i = 0; i < std::size(arrInput); ++i)
@@ -820,7 +815,8 @@ UNIT_CLASS_TEST(TestRawGenerator, Place_NoCityBoundaries)
// Check that we have NO boundaries in World.
FrozenDataSource dataSource;
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
auto const res =
dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(generator.GetMwmPath(worldMwmName)));
TEST_EQUAL(res.second, MwmSet::RegResult::Success, ());
search::CitiesBoundariesTable table(dataSource);
@@ -901,9 +897,9 @@ UNIT_TEST(MiniRoundabout_Connectivity)
std::string const mwmName = "MiniRoundabout";
std::string const arrFiles[] = {
"./data/test_data/osm/mini_roundabout_1.osm",
"./data/test_data/osm/mini_roundabout_2.osm",
"./data/test_data/osm/mini_roundabout_3.osm",
"./data/test_data/osm/mini_roundabout_1.osm",
"./data/test_data/osm/mini_roundabout_2.osm",
"./data/test_data/osm/mini_roundabout_3.osm",
};
for (auto const & fileName : arrFiles)
@@ -927,10 +923,8 @@ UNIT_TEST(MiniRoundabout_Connectivity)
auto const IsPointInRoundabout = [&roundabout](m2::PointD const & pt)
{
for (auto const & p : roundabout)
{
if (AlmostEqualAbs(p, pt, kMwmPointAccuracy))
return true;
}
return false;
};
@@ -1138,10 +1132,10 @@ UNIT_CLASS_TEST(TestRawGenerator, Addr_Street_Place)
bool m_checkStreet, m_checkPlace;
};
TestData const arrFiles[] = {
{ "./data/test_data/osm/addr_street_place.osm", 1, true, true },
{ "./data/test_data/osm/addr_street_very_far.osm", 2, true, false },
{ "./data/test_data/osm/zelenograd.osm", 1, false, true },
{ "./data/test_data/osm/addr_area_street.osm", 1, true, false },
{"./data/test_data/osm/addr_street_place.osm", 1, true, true},
{"./data/test_data/osm/addr_street_very_far.osm", 2, true, false},
{"./data/test_data/osm/zelenograd.osm", 1, false, true},
{"./data/test_data/osm/addr_area_street.osm", 1, true, false},
};
for (auto const & data : arrFiles)
@@ -1234,4 +1228,4 @@ UNIT_CLASS_TEST(TestRawGenerator, Railway_Station)
TEST_EQUAL(count, 1, ());
}
} // namespace raw_generator_tests
} // namespace raw_generator_tests