[test] Add validity check to robustness test of buffer

This commit is contained in:
Barend Gehrels 2017-11-29 14:39:20 +01:00
parent 99da88ac26
commit c9ea4b50ed

View File

@ -87,8 +87,8 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon cons
bool result = true; bool result = true;
// Area of buffer must be larger than of original polygon // Area of buffer must be larger than of original polygon
BOOST_AUTO(area_mp, bg::area(mp)); double area_mp = bg::area(mp);
BOOST_AUTO(area_buf, bg::area(buffer)); double area_buf = bg::area(buffer);
if (area_buf < area_mp) if (area_buf < area_mp)
{ {
@ -109,6 +109,16 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon cons
} }
} }
if (result)
{
std::string message;
if (! bg::is_valid(buffer, message))
{
std::cout << "Buffer is not valid: " << message << std::endl;
result = false;
}
}
bool svg = settings.svg; bool svg = settings.svg;
bool wkt = settings.wkt; bool wkt = settings.wkt;
if (! result) if (! result)
@ -204,7 +214,7 @@ bool test_buffer(MultiPolygon& result, int& index,
bg::strategy::buffer::end_round end_strategy; bg::strategy::buffer::end_round end_strategy;
bg::strategy::buffer::point_circle point_strategy; bg::strategy::buffer::point_circle point_strategy;
bg::strategy::buffer::side_straight side_strategy; bg::strategy::buffer::side_straight side_strategy;
bg::strategy::buffer::join_round join_round_strategy(100); // Compatible with unit tests bg::strategy::buffer::join_round join_round_strategy(32); // Compatible with MySQL
bg::strategy::buffer::join_miter join_miter_strategy; bg::strategy::buffer::join_miter join_miter_strategy;
try try