diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 956518323..56ee684ea 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -461,6 +461,16 @@ static std::string ticket_9081[2] = "MULTIPOLYGON(((0.2099392122251989 0.492066865490789,0.1124301889095737 0.5124668111209448,0.3306914939102383 0.6126684490171914,0.2099392122251989 0.492066865490789)),((0.5885369465145437 0.6478961722242873,0.5342320718598281 0.6686303269145104,0.5619623880692838 0.7033299168703926,0.5945761233023867 0.6823532655194001,0.5885369465145437 0.6478961722242873)),((0.5570738195183501 0.6001870087680015,0.5429714753344335 0.6231021858940831,0.5880357506342242 0.6450365518134291,0.5838690879677763 0.6212632646137447,0.568218114394707 0.5970364466647042,0.5570738195183501 0.6001870087680015)),((0.5498478321815098 0.5029279381860542,0.608691671498764 0.5163121433149205,0.5636607291345047 0.5894838094559455,0.8595233008819849 0.8301950132755517,0.8285440738598029 0.8412277162756114,0.9591357158116398 0.9011810663167211,0.8572649311807611 0.3566393017365032,0.5965816668471951 0.4111770689940296,0.5498478321815098 0.5029279381860542)),((0.3984249865018206 0.4526335964808558,0.3621206996557855 0.4602288471829723,0.4183516736935784 0.4730187483833363,0.4099611282054451 0.4644351568071601,0.3984249865018206 0.4526335964808558)))" }; +// Integer, ccw, open +static std::string ticket_10661[3] = + { + /* A */ "MULTIPOLYGON(((1701 985,3501 985,3501 2785,1701 2785,1701 985)))", + /* B */ "MULTIPOLYGON(((1698 1860,1698 1122,2598 1392,3492 1842,3492 32706,2598 2340,1698 1860)))", + /* C=A-B, */ + /* D */ "MULTIPOLYGON(((1698 2772,1698 1860,2598 2340,3492 2412,3492 32743,1698 2772)))" + // Reported problem was: validity of difference C-D + }; + // Integer, ccw, open static std::string ticket_10803[2] = { diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index 8a295a0e6..c71a04756 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -206,6 +206,29 @@ void test_specific() 2, -1, -1, settings); } + + { + ut_settings settings; + settings.test_validity = true; + + std::string a_min_b = + test_one("ticket_10661_1", + ticket_10661[0], ticket_10661[1], + 2, 11, 1441632.5, + 2, 7, 13167454, + settings); + + settings.test_validity = false; +#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS + settings.test_validity = true; +#endif + test_one("ticket_10661_2", + a_min_b, ticket_10661[2], + 1, 8, 825192.0, + 1, 10, 27226370.5, + 1, -1, 825192.0 + 27226370.5, + settings); + } } diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index d71911a57..685e83f0b 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -116,7 +116,7 @@ void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Ou } template -void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2, +std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g2, int expected_count, int expected_point_count, double expected_area, bool sym, @@ -141,6 +141,9 @@ void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2, bg::remove_spikes(result); } + std::ostringstream return_string; + return_string << bg::wkt(result); + typename bg::default_area_result::type const area = bg::area(result); std::size_t const n = expected_point_count >= 0 ? bg::num_points(result) : 0; @@ -215,6 +218,7 @@ void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2, #endif + return return_string.str(); } @@ -224,7 +228,7 @@ static int counter = 0; template -void test_one(std::string const& caseid, +std::string test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2, int expected_count1, int expected_point_count1, @@ -246,12 +250,12 @@ void test_one(std::string const& caseid, bg::correct(g1); bg::correct(g2); - test_difference(caseid + "_a", g1, g2, + std::string result = test_difference(caseid + "_a", g1, g2, expected_count1, expected_point_count1, expected_area1, false, settings); #ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE - return; + return result; #endif test_difference(caseid + "_b", g2, g1, @@ -266,10 +270,11 @@ void test_one(std::string const& caseid, expected_area_s, true, settings); } + return result; } template -void test_one(std::string const& caseid, +std::string test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2, int expected_count1, int expected_point_count1, @@ -279,7 +284,7 @@ void test_one(std::string const& caseid, double expected_area2, ut_settings const& settings = ut_settings()) { - test_one(caseid, wkt1, wkt2, + return test_one(caseid, wkt1, wkt2, expected_count1, expected_point_count1, expected_area1, expected_count2, expected_point_count2, expected_area2, expected_count1 + expected_count2,