Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kuznetsov <r.kuznetsow@gmail.com>2017-05-14 11:27:17 +0300
committerGitHub <noreply@github.com>2017-05-14 11:27:17 +0300
commit1c352e767fb005debc79c31f9f5dbd32949126ef (patch)
tree22047b71fc27a83efba51c180dc4bb98fa621ba6
parent0961b7e31895c7b8f6137315c171a740ea997da1 (diff)
parentb639223735ccaa47a5aecbdd395fb2dd056aad6c (diff)
Merge pull request #6041 from dobriy-eeh/fix-restriction-test-loop-graphbeta-805
[routing] Fix index_graph_test.cpp::RestrictionTest_LoopGraph
-rw-r--r--routing/routing_tests/index_graph_test.cpp9
-rw-r--r--routing/routing_tests/index_graph_tools.cpp16
-rw-r--r--routing/routing_tests/index_graph_tools.hpp4
3 files changed, 9 insertions, 20 deletions
diff --git a/routing/routing_tests/index_graph_test.cpp b/routing/routing_tests/index_graph_test.cpp
index 1a996fe129..44505eaf01 100644
--- a/routing/routing_tests/index_graph_test.cpp
+++ b/routing/routing_tests/index_graph_test.cpp
@@ -508,8 +508,13 @@ UNIT_CLASS_TEST(RestrictionTest, LoopGraph)
routing::IndexGraphStarter::FakeVertex(kTestNumMwmId, 2, 0 /* seg id */,
m2::PointD(0.00005, 0.0004)) /* finish */);
- double constexpr kExpectedRouteTimeSec = 3.92527;
- TestRouteTime(*m_starter, AStarAlgorithm<IndexGraphStarter>::Result::OK, kExpectedRouteTimeSec);
+ vector<Segment> const expectedRoute = {{kTestNumMwmId, 1, 0, true}, {kTestNumMwmId, 0, 0, true},
+ {kTestNumMwmId, 0, 1, true}, {kTestNumMwmId, 0, 8, false},
+ {kTestNumMwmId, 0, 7, false}, {kTestNumMwmId, 0, 6, false},
+ {kTestNumMwmId, 2, 0, true}};
+
+ TestRoute(m_starter->GetStartVertex(), m_starter->GetFinishVertex(), 7, &expectedRoute,
+ m_starter->GetGraph());
}
UNIT_TEST(IndexGraph_OnlyTopology_1)
diff --git a/routing/routing_tests/index_graph_tools.cpp b/routing/routing_tests/index_graph_tools.cpp
index d5de50bf1b..20fd44c99b 100644
--- a/routing/routing_tests/index_graph_tools.cpp
+++ b/routing/routing_tests/index_graph_tools.cpp
@@ -278,7 +278,8 @@ shared_ptr<EdgeEstimator> CreateEstimatorForCar(traffic::TrafficCache const & tr
shared_ptr<EdgeEstimator> CreateEstimatorForCar(shared_ptr<TrafficStash> trafficStash)
{
- return EdgeEstimator::CreateForCar(trafficStash, 90.0 /* maxSpeedKMpH */);
+ return EdgeEstimator::CreateForCar(trafficStash,
+ CarModelFactory().GetVehicleModel()->GetMaxSpeed());
}
AStarAlgorithm<IndexGraphStarter>::Result CalculateRoute(IndexGraphStarter & starter,
@@ -337,19 +338,6 @@ void TestRouteGeometry(IndexGraphStarter & starter,
TEST_EQUAL(geom, expectedRouteGeom, ());
}
-void TestRouteTime(IndexGraphStarter & starter,
- AStarAlgorithm<IndexGraphStarter>::Result expectedRouteResult,
- double expectedTime)
-{
- vector<Segment> routeSegs;
- double timeSec = 0.0;
- auto const resultCode = CalculateRoute(starter, routeSegs, timeSec);
-
- TEST_EQUAL(resultCode, expectedRouteResult, ());
- double const kEpsilon = 1e-5;
- TEST(my::AlmostEqualAbs(timeSec, expectedTime, kEpsilon), ());
-}
-
void TestRestrictions(vector<m2::PointD> const & expectedRouteGeom,
AStarAlgorithm<IndexGraphStarter>::Result expectedRouteResult,
routing::IndexGraphStarter::FakeVertex const & start,
diff --git a/routing/routing_tests/index_graph_tools.hpp b/routing/routing_tests/index_graph_tools.hpp
index 345c891960..808e81b7a9 100644
--- a/routing/routing_tests/index_graph_tools.hpp
+++ b/routing/routing_tests/index_graph_tools.hpp
@@ -196,10 +196,6 @@ void TestRouteGeometry(
routing::AStarAlgorithm<routing::IndexGraphStarter>::Result expectedRouteResult,
vector<m2::PointD> const & expectedRouteGeom);
-void TestRouteTime(IndexGraphStarter & starter,
- AStarAlgorithm<IndexGraphStarter>::Result expectedRouteResult,
- double expectedTime);
-
/// \brief Applies |restrictions| to graph in |restrictionTest| and
/// tests the resulting route.
/// \note restrictionTest should have a valid |restrictionTest.m_graph|.