mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-01 08:32:10 +00:00
[test] add optional check of input validity
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user