From 07872acca16c73a7172ecfa232cd0fa5448dff83 Mon Sep 17 00:00:00 2001 From: barendgehrels Date: Fri, 16 Dec 2016 12:30:11 +0100 Subject: [PATCH] [test] add (still failing) test for validity needing self-turn --- test/algorithms/overlay/multi_overlay_cases.hpp | 8 ++++++++ .../set_operations/difference/difference_multi.cpp | 6 ++++++ .../set_operations/intersection/intersection_multi.cpp | 1 + test/algorithms/set_operations/union/union_multi.cpp | 2 ++ 4 files changed, 17 insertions(+) diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index da64e48e9..d44df36b9 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -523,6 +523,14 @@ static std::string case_125_multi[2] = "MULTIPOLYGON(((1 0,1 2,2 2,2 0,1 0)),((0 1,0 2,1 1,0 1)))" }; +static std::string case_126_multi[2] = +{ + // Intersection: should result in multi-polygon of 5 (needs self-intersections) + "MULTIPOLYGON(((5 5,5 10,10 10,10 5,5 5),(9 8,7 9,5 8,7 7,9 8)),((3 3,3 5,5 5,5 3,3 3)))", + "MULTIPOLYGON(((0 3,6 3,6 9,0 9,0 3),(2 6,4 7,6 6,4 5,2 6)),((6 9,6 11,8 11,8 9,6 9)))" +}; + + static std::string case_recursive_boxes_1[2] = { "MULTIPOLYGON(((1 0,0 0,0 1,1 1,1 2,0 2,0 4,2 4,2 5,3 5,3 6,1 6,1 5,0 5,0 10,9 10,9 9,7 9,7 8,6 8,6 7,8 7,8 6,9 6,9 4,8 4,8 3,10 3,10 0,6 0,6 1,5 1,5 0,1 0),(8 4,8 5,7 5,7 6,6 6,6 5,5 5,5 4,4 4,4 3,5 3,5 2,7 2,7 3,6 3,6 4,8 4),(8 1,9 1,9 2,8 2,8 1),(4 7,4 9,3 9,3 7,4 7)),((9 9,10 9,10 7,10 6,9 6,9 7,8 7,8 8,9 8,9 9)))", diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index 0df2fe34e..ce985df36 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -27,6 +27,10 @@ (test_one) \ ( #caseid, caseid[0], caseid[1], clips1, points1, area1, clips2, points2, area2) +#define TEST_DIFFERENCE_IGNORE(caseid, clips1, points1, area1, clips2, points2, area2) \ + (test_one) \ + ( #caseid, caseid[0], caseid[1], clips1, points1, area1, clips2, points2, area2, ignore_validity) + template void test_areal() @@ -93,6 +97,8 @@ void test_areal() TEST_DIFFERENCE(case_123_multi, 1, 4, 0.25, 2, 9, 0.625); TEST_DIFFERENCE(case_124_multi, 1, 4, 0.25, 2, 9, 0.4375); + TEST_DIFFERENCE_IGNORE(case_125_multi, 1, 4, 0.25, 2, 12, 0.400); + TEST_DIFFERENCE_IGNORE(case_126_multi, 3, 22, 16.0, 4, 27, 27.0); // A should have 3 clips, B should have 5 clips { ut_settings settings; diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index 81211704d..251da3c50 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -145,6 +145,7 @@ void test_areal() TEST_INTERSECTION(case_123_multi, 3, 13, 1.875); TEST_INTERSECTION(case_124_multi, 2, 13, 2.0625); TEST_INTERSECTION_IGNORE(case_125_multi, 3, 17, 2.1); + TEST_INTERSECTION_IGNORE(case_126_multi, 3, 23, 9.0); // #1 needs self-turns to make valid test_one("case_recursive_boxes_1", diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index 88289e8cc..bc8a47655 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -183,6 +183,8 @@ void test_areal() TEST_UNION(case_123_multi, 1, 0, 11, 2.75); TEST_UNION(case_124_multi, 1, 0, 9, 2.75); + TEST_UNION(case_125_multi, 1, 0, 9, 2.75); + TEST_UNION(case_126_multi, 1, 2, 27, 52.0); test_one("case_recursive_boxes_1", case_recursive_boxes_1[0], case_recursive_boxes_1[1],