[test] add optional check of input validity

This commit is contained in:
Barend Gehrels
2016-06-01 13:48:20 +02:00
parent 597ea22bef
commit e5652cffe1

View File

@@ -55,6 +55,20 @@ struct ut_settings
};
#if defined(BOOST_GEOMETRY_TEST_CHECK_VALID_INPUT)
template <typename Geometry>
inline void check_input_validity(std::string const& caseid, int case_index,
Geometry const& geometry)
{
std::string message;
if (!bg::is_valid(geometry, message))
{
std::cout << caseid << " Input ["
<< case_index << "] not valid" << std::endl
<< " (" << message << ")" << std::endl;
}
}
#endif
template <typename OutputType, typename G1, typename G2>
void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
@@ -73,6 +87,11 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
std::cout << "*** UNION " << caseid << std::endl;
#endif
#if defined(BOOST_GEOMETRY_TEST_CHECK_VALID_INPUT)
check_input_validity(caseid, 0, g1);
check_input_validity(caseid, 1, g2);
#endif
bg::union_(g1, g2, clip);
typename bg::default_area_result<OutputType>::type area = 0;