From d1e1190cbda5666bccbd9c701c33e5779d87c320 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Sat, 21 Sep 2013 22:18:27 +0200 Subject: [PATCH] replace cassert by boost asserts --- RoutingAlgorithms/ShortestPathRouting.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/RoutingAlgorithms/ShortestPathRouting.h b/RoutingAlgorithms/ShortestPathRouting.h index 6b6d6b1db..d62920c13 100644 --- a/RoutingAlgorithms/ShortestPathRouting.h +++ b/RoutingAlgorithms/ShortestPathRouting.h @@ -23,8 +23,9 @@ or see http://www.gnu.org/licenses/agpl.txt. #ifndef SHORTESTPATHROUTING_H_ #define SHORTESTPATHROUTING_H_ -#include "BasicRoutingInterface.h" +#include +#include "BasicRoutingInterface.h" #include "../DataStructures/SearchEngineData.h" template @@ -206,7 +207,10 @@ public: } //Was at most one of the two paths not found? - assert(INT_MAX != distance1 || INT_MAX != distance2); + BOOST_ASSERT_MSG( + (INT_MAX != distance1 || INT_MAX != distance2), + "no path found" + ); //Unpack paths if they exist std::vector temporary_packed_path1; @@ -247,13 +251,22 @@ public: local_upper_bound2 = local_upper_bound1; } - assert(temporary_packed_path1.empty() && temporary_packed_path2.empty()); + BOOST_ASSERT_MSG( + temporary_packed_path1.empty() && + temporary_packed_path2.empty(), + "tempory packed paths not empty" + ); //Plug paths together, s.t. end of packed path is begin of temporary packed path if( !packed_path1.empty() && !packed_path2.empty() ) { if( temporary_packed_path1.front() == temporary_packed_path2.front() ) { //both new route segments start with the same node, thus one of the packedPath must go. - assert( (packed_path1.size() == packed_path2.size() ) || (*(packed_path1.end()-1) != *(packed_path2.end()-1)) ); + BOOST_ASSERT_MSG( + (packed_path1.size() == packed_path2.size() ) || + (packed_path1.back() != packed_path2.back() ), + "packed paths must be different" + ); + if( packed_path1.back() == temporary_packed_path1.front()) { packed_path2.clear(); packed_path2.insert(