[test] add (still failing) test for validity needing self-turn

This commit is contained in:
barendgehrels
2016-12-16 12:30:11 +01:00
parent e1fdd496dd
commit 07872acca1
4 changed files with 17 additions and 0 deletions

View File

@@ -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)))",

View File

@@ -27,6 +27,10 @@
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
( #caseid, caseid[0], caseid[1], clips1, points1, area1, clips2, points2, area2)
#define TEST_DIFFERENCE_IGNORE(caseid, clips1, points1, area1, clips2, points2, area2) \
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
( #caseid, caseid[0], caseid[1], clips1, points1, area1, clips2, points2, area2, ignore_validity)
template <typename Ring, typename Polygon, typename MultiPolygon>
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;

View File

@@ -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<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",

View File

@@ -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<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
case_recursive_boxes_1[0], case_recursive_boxes_1[1],