From 5a21b951cb65cfba674f0b7fe4ffd6fff75b8c2f Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Thu, 21 May 2015 18:14:16 +0300 Subject: [PATCH] [routing] Generator bounding box calculation bugfix and test for user report route --- generator/routing_generator.cpp | 9 +++++---- integration_tests/osrm_route_test.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/generator/routing_generator.cpp b/generator/routing_generator.cpp index e4599a1498..188ea3dffe 100644 --- a/generator/routing_generator.cpp +++ b/generator/routing_generator.cpp @@ -54,10 +54,11 @@ bool LoadIndexes(string const & mwmFile, string const & osrmFile, osrm::NodeData bool CheckBBoxCrossingBorder(m2::RegionD const & border, osrm::NodeData const & data) { - double minLon = numeric_limits::max(); - double minLat = numeric_limits::max(); - double maxLon = numeric_limits::min(); - double maxLat = numeric_limits::min(); + ASSERT(data.m_segments.size(), ()); + double minLon = data.m_segments[0].lon1; + double minLat = data.m_segments[0].lat1; + double maxLon = data.m_segments[0].lon1; + double maxLat = data.m_segments[0].lat1; for (auto const & segment : data.m_segments) { minLon = min(minLon, min(segment.lon1, segment.lon2)); diff --git a/integration_tests/osrm_route_test.cpp b/integration_tests/osrm_route_test.cpp index 21e995c983..555b6c0078 100644 --- a/integration_tests/osrm_route_test.cpp +++ b/integration_tests/osrm_route_test.cpp @@ -79,4 +79,16 @@ namespace integration::GetAllMaps(), MercatorBounds::FromLatLon(42.01201, 19.36286), {0., 0.}, MercatorBounds::FromLatLon(42.01535, 19.40044), 3674.); } + + UNIT_TEST(CanadaBridgeCrossToEdwardIsland) + { + // Forward + integration::CalculateRouteAndTestRouteLength( + integration::GetAllMaps(), MercatorBounds::FromLatLon(46.13418, -63.84656), {0., 0.}, + MercatorBounds::FromLatLon(46.26739,-63.63907), 23000.); + // And backward case + integration::CalculateRouteAndTestRouteLength( + integration::GetAllMaps(), MercatorBounds::FromLatLon(46.26739, -63.63907), {0., 0.}, + MercatorBounds::FromLatLon(46.13418, -63.84656), 23000.); + } }