[test][get_turns] Add additional output for debugging purposes, enabled with macro definition.

This commit is contained in:
Adam Wulkiewicz
2015-03-16 17:28:12 +01:00
parent 062a7abce9
commit a239fb629a

View File

@@ -156,6 +156,10 @@ void check_geometry_range(
bool ok = boost::size(expected) == turns.size();
#ifdef BOOST_GEOMETRY_TEST_DEBUG
std::vector<turn_info> 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<Geometry1>::type).name()
<< ", "
<< typeid(typename bg::coordinate_type<Geometry2>::type).name()
<< std::endl;
std::cout << "Detected: ";
if ( turns_dbg.empty() )
{
std::cout << "{empty}";
}
else
{
for ( typename std::vector<turn_info>::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 <typename Geometry1, typename Geometry2, typename Expected>