From e74f63ef6b4c8b8ed15b5ab80d83bfd9ecfadb8c Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Fri, 23 Jun 2017 17:23:27 +0300 Subject: [PATCH] Checking that route items are sorted by index. --- routing/routing_helpers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routing/routing_helpers.cpp b/routing/routing_helpers.cpp index 26f7448fb0..baf6f02ce0 100644 --- a/routing/routing_helpers.cpp +++ b/routing/routing_helpers.cpp @@ -3,6 +3,10 @@ #include "traffic/traffic_info.hpp" +#include "base/stl_helpers.hpp" + +#include + namespace routing { using namespace traffic; @@ -43,6 +47,9 @@ void ReconstructRoute(IDirectionsEngine & engine, RoadGraphBase const & graph, return; } + CHECK(std::is_sorted(times.cbegin(), times.cend(), my::LessBy(&Route::TTimeItem::first)), ()); + CHECK(std::is_sorted(turnsDir.cbegin(), turnsDir.cend(), my::LessBy(&turns::TurnItem::m_index)), ()); + // @TODO(bykoianko) If the start and the finish of a route lies on the same road segment // engine->Generate() fills with empty vectors |times|, |turnsDir|, |junctions| and |segments|. // It's not correct and should be fixed. It's necessary to work corrrectly with such routes.