From a239fb629a19cb7aa66fcdff7fc1aba2c4d64cd2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Mon, 16 Mar 2015 17:28:12 +0100 Subject: [PATCH] [test][get_turns] Add additional output for debugging purposes, enabled with macro definition. --- test/algorithms/overlay/test_get_turns.hpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/algorithms/overlay/test_get_turns.hpp b/test/algorithms/overlay/test_get_turns.hpp index 6aa781910..314c5c8c4 100644 --- a/test/algorithms/overlay/test_get_turns.hpp +++ b/test/algorithms/overlay/test_get_turns.hpp @@ -156,6 +156,10 @@ void check_geometry_range( bool ok = boost::size(expected) == turns.size(); +#ifdef BOOST_GEOMETRY_TEST_DEBUG + std::vector turns_dbg = turns; +#endif + BOOST_CHECK_MESSAGE(ok, "get_turns: " << wkt1 << " and " << wkt2 << " -> Expected turns #: " << boost::size(expected) << " detected turns #: " << turns.size()); @@ -170,11 +174,43 @@ void check_geometry_range( turns.erase(it); else { + ok = false; BOOST_CHECK_MESSAGE(false, "get_turns: " << wkt1 << " and " << wkt2 << " -> Expected turn: " << *sit << " not found"); } } + +#ifdef BOOST_GEOMETRY_TEST_DEBUG + if ( !ok ) + { + std::cout << "Coordinates: " + << typeid(typename bg::coordinate_type::type).name() + << ", " + << typeid(typename bg::coordinate_type::type).name() + << std::endl; + std::cout << "Detected: "; + if ( turns_dbg.empty() ) + { + std::cout << "{empty}"; + } + else + { + for ( typename std::vector::const_iterator it = turns_dbg.begin() ; + it != turns_dbg.end() ; ++it ) + { + if ( it != turns_dbg.begin() ) + std::cout << ", "; + std::cout << bg::method_char(it->method); + std::cout << bg::operation_char(it->operations[0].operation); + std::cout << bg::operation_char(it->operations[1].operation); + std::cout << equal_turn<1>::is_colinear_char(it->operations[0].is_collinear); + std::cout << equal_turn<1>::is_colinear_char(it->operations[1].is_collinear); + } + } + std::cout << std::endl; + } +#endif } template