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

@@ -22,10 +22,8 @@ std::set<std::string> const kBicycleMapFiles = {"Russia_Moscow"};
class BicycleTest : public RoutingTest
{
public:
BicycleTest()
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Bicycle, kBicycleMapFiles)
{
}
BicycleTest() : RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Bicycle, kBicycleMapFiles)
{}
protected:
std::unique_ptr<routing::VehicleModelFactoryInterface> CreateModelFactory() override

View File

@@ -21,10 +21,7 @@ std::set<std::string> const kCarMapFiles = {"Russia_Moscow"};
class CarTest : public RoutingTest
{
public:
CarTest()
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Car, kCarMapFiles)
{
}
CarTest() : RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Car, kCarMapFiles) {}
void TestCarRouter(ms::LatLon const & start, ms::LatLon const & final, size_t reiterations)
{

View File

@@ -17,8 +17,8 @@
#include "coding/point_coding.hpp"
#include "geometry/mercator.hpp"
#include "geometry/polyline2d.hpp"
#include "geometry/point_with_altitude.hpp"
#include "geometry/polyline2d.hpp"
#include "base/logging.hpp"
#include "base/math.hpp"
@@ -42,7 +42,10 @@ m2::PointD GetPointOnEdge(routing::Edge const & e, double posAlong)
RoutingTest::RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType type,
std::set<std::string> const & neededMaps)
: m_mode(mode), m_type(type), m_neededMaps(neededMaps), m_numMwmIds(std::make_unique<routing::NumMwmIds>())
: m_mode(mode)
, m_type(type)
, m_neededMaps(neededMaps)
, m_numMwmIds(std::make_unique<routing::NumMwmIds>())
{
classificator::Load();
@@ -73,10 +76,8 @@ RoutingTest::RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType ty
if (registeredMaps != m_neededMaps)
{
for (auto const & file : m_neededMaps)
{
if (registeredMaps.count(file) == 0)
LOG(LERROR, ("Can't find map:", file));
}
TEST(false, ("Some maps can't be found. See error messages above."));
}
}
@@ -99,7 +100,7 @@ void RoutingTest::TestRouters(m2::PointD const & startPos, m2::PointD const & fi
double constexpr kEpsilon = 1e-6;
TEST(AlmostEqualAbs(routeFoundByAstar.GetTotalDistanceMeters(),
routeFoundByAstarBidirectional.GetTotalDistanceMeters(), kEpsilon),
routeFoundByAstarBidirectional.GetTotalDistanceMeters(), kEpsilon),
());
}
@@ -115,8 +116,7 @@ void RoutingTest::TestTwoPointsOnFeature(m2::PointD const & startPos, m2::PointD
m2::PointD const startPosOnFeature =
GetPointOnEdge(startEdges.front().first, 0.0 /* the start point of the feature */);
m2::PointD const finalPosOnFeature =
GetPointOnEdge(finalEdges.front().first, 1.0 /* the end point of the feature */);
m2::PointD const finalPosOnFeature = GetPointOnEdge(finalEdges.front().first, 1.0 /* the end point of the feature */);
TestRouters(startPosOnFeature, finalPosOnFeature);
}
@@ -126,13 +126,11 @@ std::unique_ptr<routing::IRouter> RoutingTest::CreateRouter(std::string const &
std::vector<platform::LocalCountryFile> neededLocalFiles;
neededLocalFiles.reserve(m_neededMaps.size());
for (auto const & file : m_localFiles)
{
if (m_neededMaps.count(file.GetCountryName()) != 0)
neededLocalFiles.push_back(file);
}
std::unique_ptr<routing::IRouter> router = integration::CreateVehicleRouter(
m_dataSource, *m_cig, m_trafficCache, neededLocalFiles, m_type);
std::unique_ptr<routing::IRouter> router =
integration::CreateVehicleRouter(m_dataSource, *m_cig, m_trafficCache, neededLocalFiles, m_type);
return router;
}
@@ -141,20 +139,19 @@ void RoutingTest::GetNearestEdges(m2::PointD const & pt,
{
routing::MwmDataSource dataSource(m_dataSource, nullptr /* numMwmIDs */);
routing::FeaturesRoadGraph graph(dataSource, m_mode, CreateModelFactory());
graph.FindClosestEdges(mercator::RectByCenterXYAndSizeInMeters(
pt, routing::FeaturesRoadGraph::kClosestEdgesRadiusM),
graph.FindClosestEdges(mercator::RectByCenterXYAndSizeInMeters(pt, routing::FeaturesRoadGraph::kClosestEdgesRadiusM),
1 /* count */, edges);
}
void TestRouter(routing::IRouter & router, m2::PointD const & startPos,
m2::PointD const & finalPos, routing::Route & route)
void TestRouter(routing::IRouter & router, m2::PointD const & startPos, m2::PointD const & finalPos,
routing::Route & route)
{
routing::RouterDelegate delegate;
LOG(LINFO, ("Calculating routing ...", router.GetName()));
base::Timer timer;
auto const resultCode = router.CalculateRoute(routing::Checkpoints(startPos, finalPos),
m2::PointD::Zero() /* startDirection */,
false /* adjust */, delegate, route);
auto const resultCode =
router.CalculateRoute(routing::Checkpoints(startPos, finalPos), m2::PointD::Zero() /* startDirection */,
false /* adjust */, delegate, route);
double const elapsedSec = timer.ElapsedSeconds();
TEST_EQUAL(routing::RouterResultCode::NoError, resultCode, ());
TEST(route.IsValid(), ());

View File

@@ -24,8 +24,7 @@
class RoutingTest
{
public:
RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType type,
std::set<std::string> const & neededMaps);
RoutingTest(routing::IRoadGraph::Mode mode, routing::VehicleType type, std::set<std::string> const & neededMaps);
virtual ~RoutingTest() = default;
@@ -93,5 +92,5 @@ private:
std::shared_ptr<SimplifiedModel> const m_model;
};
void TestRouter(routing::IRouter & router, m2::PointD const & startPos,
m2::PointD const & finalPos, routing::Route & route);
void TestRouter(routing::IRouter & router, m2::PointD const & startPos, m2::PointD const & finalPos,
routing::Route & route);

View File

@@ -18,37 +18,31 @@ using namespace std;
// Test preconditions: files from the kPedestrianMapFiles set with '.mwm'
// extension must be placed in omim/data folder.
set<string> const kPedestrianMapFiles =
{
"UK_England_East Midlands",
"UK_England_East of England_Essex",
"UK_England_East of England_Norfolk",
"UK_England_Greater London",
"UK_England_North East England",
"UK_England_North West England_Lancaster",
"UK_England_North West England_Manchester",
"UK_England_South East_Brighton",
"UK_England_South East_Oxford",
"UK_England_South West England_Bristol",
"UK_England_South West England_Cornwall",
"UK_England_West Midlands",
"UK_England_Yorkshire and the Humber"
};
set<string> const kPedestrianMapFiles = {"UK_England_East Midlands",
"UK_England_East of England_Essex",
"UK_England_East of England_Norfolk",
"UK_England_Greater London",
"UK_England_North East England",
"UK_England_North West England_Lancaster",
"UK_England_North West England_Manchester",
"UK_England_South East_Brighton",
"UK_England_South East_Oxford",
"UK_England_South West England_Bristol",
"UK_England_South West England_Cornwall",
"UK_England_West Midlands",
"UK_England_Yorkshire and the Humber"};
class PedestrianTest : public RoutingTest
{
public:
PedestrianTest()
: RoutingTest(routing::IRoadGraph::Mode::IgnoreOnewayTag, routing::VehicleType::Pedestrian,
kPedestrianMapFiles)
{
}
: RoutingTest(routing::IRoadGraph::Mode::IgnoreOnewayTag, routing::VehicleType::Pedestrian, kPedestrianMapFiles)
{}
protected:
unique_ptr<routing::VehicleModelFactoryInterface> CreateModelFactory() override
{
unique_ptr<routing::VehicleModelFactoryInterface> factory(
new SimplifiedModelFactory<routing::PedestrianModel>());
unique_ptr<routing::VehicleModelFactoryInterface> factory(new SimplifiedModelFactory<routing::PedestrianModel>());
return factory;
}
};