Skip to content

Commit

Permalink
[routing] Adding two routing integration tests on two thread A* bidir…
Browse files Browse the repository at this point in the history
…ectional routing.
  • Loading branch information
bykoianko committed Nov 19, 2020
1 parent 6066578 commit 54cbfb1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions routing/routing_integration_tests/pedestrian_route_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,13 @@ UNIT_TEST(NoTurnOnForkingRoad2)

TEST_EQUAL(t[0].m_pedestrianTurn, PedestrianDirection::TurnRight, ());
}

// Test on two threads A* bidirectional routing.
UNIT_TEST(RussiaMoscowTarusaTwoThreads)
{
integration::CalculateRouteAndTestRouteLength(
integration::GetVehicleComponents(VehicleType::Pedestrian),
mercator::FromLatLon(55.85779, 37.40948), {0.0, 0.0},
mercator::FromLatLon(54.71961, 37.19449), 162575.0, 0.07 /* relativeError */,
true /* useTwoThreads */);
}
11 changes: 11 additions & 0 deletions routing/routing_integration_tests/route_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,15 @@ namespace
integration::GetVehicleComponents(VehicleType::Car),
mercator::FromLatLon(55.31103, 38.80954), {0., 0.}, mercator::FromLatLon(55.31155, 38.8217), 2489.8);
}

// Test on two threads A* bidirectional routing.
UNIT_TEST(RussiaMoscowStStPetersburgTwoThreads)
{
auto & vehicleComponents = integration::GetVehicleComponents(VehicleType::Car);

integration::CalculateRouteAndTestRouteLength(
vehicleComponents, mercator::FromLatLon(55.74942, 37.62118), {0.0, 0.0},
mercator::FromLatLon(59.9394, 30.31492), 706503.0, 0.07 /* relativeError */,
true /* useTwoThreads */);
}
} // namespace
4 changes: 2 additions & 2 deletions routing/routing_integration_tests/routing_test_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ void CalculateRouteAndTestRouteLength(IRouterComponents const & routerComponents
m2::PointD const & startPoint,
m2::PointD const & startDirection,
m2::PointD const & finalPoint, double expectedRouteMeters,
double relativeError /* = 0.07 */)
double relativeError /* = 0.07 */, bool useTwoThreads /* = false */)
{
TRouteResult routeResult =
CalculateRoute(routerComponents, startPoint, startDirection, finalPoint);
CalculateRoute(routerComponents, startPoint, startDirection, finalPoint, useTwoThreads);
RouterResultCode const result = routeResult.second;
TEST_EQUAL(result, RouterResultCode::NoError, ());
CHECK(routeResult.first, ());
Expand Down
2 changes: 1 addition & 1 deletion routing/routing_integration_tests/routing_test_tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void CalculateRouteAndTestRouteLength(IRouterComponents const & routerComponents
m2::PointD const & startPoint,
m2::PointD const & startDirection,
m2::PointD const & finalPoint, double expectedRouteMeters,
double relativeError = 0.07);
double relativeError = 0.07, bool useTwoThreads = false);

void CalculateRouteAndTestRouteTime(IRouterComponents const & routerComponents,
m2::PointD const & startPoint,
Expand Down

0 comments on commit 54cbfb1

Please sign in to comment.