From c79a4bb9832037c7f474118e81da9c55dde7ee15 Mon Sep 17 00:00:00 2001 From: Fabian Keller Date: Mon, 27 Jan 2020 22:10:49 +0100 Subject: [PATCH] simplified feature type tests --- .../feature_types/clipping_poly.geojson | 31 --- .../fixtures/feature_types/multi_poly.geojson | 57 ----- .../multi_poly_with_hole.geojson | 79 ------- .../difference/multi_poly_to_clipping.geojson | 79 ------- .../multi_poly_with_hole_to_clipping.geojson | 95 -------- .../out/difference/poly_to_clipping.geojson | 45 ---- .../poly_with_hole_to_clipping.geojson | 61 ----- .../multi_poly_to_clipping.geojson | 63 ----- .../multi_poly_with_hole_to_clipping.geojson | 71 ------ .../out/intersection/poly_to_clipping.geojson | 37 --- .../poly_with_hole_to_clipping.geojson | 45 ---- .../out/union/multi_poly_to_clipping.geojson | 69 ------ .../multi_poly_with_hole_to_clipping.geojson | 99 -------- .../out/union/poly_to_clipping.geojson | 53 ----- .../union/poly_with_hole_to_clipping.geojson | 83 ------- .../out/xor/multi_poly_to_clipping.geojson | 119 ---------- .../multi_poly_with_hole_to_clipping.geojson | 157 ------------- .../out/xor/poly_to_clipping.geojson | 79 ------- .../xor/poly_with_hole_to_clipping.geojson | 117 ---------- tests/fixtures/feature_types/poly.geojson | 31 --- .../feature_types/poly_with_hole.geojson | 53 ----- .../generic_test_cases/basic1_poly.geojson | 136 +++++++++++ .../basic2_poly_with_hole.geojson | 169 ++++++++++++++ .../basic3_multi_poly.geojson | 184 +++++++++++++++ .../basic4_multi_poly_with_hole.geojson | 217 ++++++++++++++++++ tests/src/feature_type_test.rs | 65 ------ tests/src/lib.rs | 2 - 27 files changed, 706 insertions(+), 1590 deletions(-) delete mode 100644 tests/fixtures/feature_types/clipping_poly.geojson delete mode 100644 tests/fixtures/feature_types/multi_poly.geojson delete mode 100644 tests/fixtures/feature_types/multi_poly_with_hole.geojson delete mode 100644 tests/fixtures/feature_types/out/difference/multi_poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/difference/multi_poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/difference/poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/difference/poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/intersection/multi_poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/intersection/multi_poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/intersection/poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/intersection/poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/union/multi_poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/union/multi_poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/union/poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/union/poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/xor/multi_poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/xor/multi_poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/xor/poly_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/out/xor/poly_with_hole_to_clipping.geojson delete mode 100644 tests/fixtures/feature_types/poly.geojson delete mode 100644 tests/fixtures/feature_types/poly_with_hole.geojson create mode 100644 tests/fixtures/generic_test_cases/basic1_poly.geojson create mode 100644 tests/fixtures/generic_test_cases/basic2_poly_with_hole.geojson create mode 100644 tests/fixtures/generic_test_cases/basic3_multi_poly.geojson create mode 100644 tests/fixtures/generic_test_cases/basic4_multi_poly_with_hole.geojson delete mode 100644 tests/src/feature_type_test.rs diff --git a/tests/fixtures/feature_types/clipping_poly.geojson b/tests/fixtures/feature_types/clipping_poly.geojson deleted file mode 100644 index 457c0aa..0000000 --- a/tests/fixtures/feature_types/clipping_poly.geojson +++ /dev/null @@ -1,31 +0,0 @@ -{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0.25, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 0.25 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/multi_poly.geojson b/tests/fixtures/feature_types/multi_poly.geojson deleted file mode 100644 index 78ab2a9..0000000 --- a/tests/fixtures/feature_types/multi_poly.geojson +++ /dev/null @@ -1,57 +0,0 @@ -{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ], - [ - [ - [ - 2, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/multi_poly_with_hole.geojson b/tests/fixtures/feature_types/multi_poly_with_hole.geojson deleted file mode 100644 index 8a5aacf..0000000 --- a/tests/fixtures/feature_types/multi_poly_with_hole.geojson +++ /dev/null @@ -1,79 +0,0 @@ -{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.2, - 0.4 - ], - [ - 0.4, - 0.4 - ], - [ - 0.4, - 0.2 - ], - [ - 0.2, - 0.2 - ] - ] - ], - [ - [ - [ - 2, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/difference/multi_poly_to_clipping.geojson b/tests/fixtures/feature_types/out/difference/multi_poly_to_clipping.geojson deleted file mode 100644 index 52e9a59..0000000 --- a/tests/fixtures/feature_types/out/difference/multi_poly_to_clipping.geojson +++ /dev/null @@ -1,79 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#25856a", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#521199", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ], - [ - [ - [ - 2, - 2.75 - ], - [ - 2.75, - 2.75 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/difference/multi_poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/difference/multi_poly_with_hole_to_clipping.geojson deleted file mode 100644 index a240d58..0000000 --- a/tests/fixtures/feature_types/out/difference/multi_poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,95 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#3a8b1f", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#36744f", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.4, - 0.25 - ], - [ - 0.4, - 0.2 - ], - [ - 0.2, - 0.2 - ], - [ - 0.2, - 0.4 - ], - [ - 0.25, - 0.4 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ], - [ - [ - [ - 2, - 2.75 - ], - [ - 2.75, - 2.75 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/difference/poly_to_clipping.geojson b/tests/fixtures/feature_types/out/difference/poly_to_clipping.geojson deleted file mode 100644 index c3c9b3f..0000000 --- a/tests/fixtures/feature_types/out/difference/poly_to_clipping.geojson +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#a50505", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#1e8c7b", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/difference/poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/difference/poly_with_hole_to_clipping.geojson deleted file mode 100644 index 6539a26..0000000 --- a/tests/fixtures/feature_types/out/difference/poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,61 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#a50505", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#1e8c7b", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.4, - 0.25 - ], - [ - 0.4, - 0.2 - ], - [ - 0.2, - 0.2 - ], - [ - 0.2, - 0.4 - ], - [ - 0.25, - 0.4 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/intersection/multi_poly_to_clipping.geojson b/tests/fixtures/feature_types/out/intersection/multi_poly_to_clipping.geojson deleted file mode 100644 index 19841f8..0000000 --- a/tests/fixtures/feature_types/out/intersection/multi_poly_to_clipping.geojson +++ /dev/null @@ -1,63 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#25856a", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#521199", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0.25, - 0.25 - ], - [ - 1, - 0.25 - ], - [ - 1, - 1 - ], - [ - 0.25, - 1 - ], - [ - 0.25, - 0.25 - ] - ] - ], - [ - [ - [ - 2, - 2 - ], - [ - 2.75, - 2 - ], - [ - 2.75, - 2.75 - ], - [ - 2, - 2.75 - ], - [ - 2, - 2 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/intersection/multi_poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/intersection/multi_poly_with_hole_to_clipping.geojson deleted file mode 100644 index 032316f..0000000 --- a/tests/fixtures/feature_types/out/intersection/multi_poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,71 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#3a8b1f", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#36744f", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0.25, - 0.4 - ], - [ - 0.4, - 0.4 - ], - [ - 0.4, - 0.25 - ], - [ - 1, - 0.25 - ], - [ - 1, - 1 - ], - [ - 0.25, - 1 - ], - [ - 0.25, - 0.4 - ] - ] - ], - [ - [ - [ - 2, - 2 - ], - [ - 2.75, - 2 - ], - [ - 2.75, - 2.75 - ], - [ - 2, - 2.75 - ], - [ - 2, - 2 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/intersection/poly_to_clipping.geojson b/tests/fixtures/feature_types/out/intersection/poly_to_clipping.geojson deleted file mode 100644 index 23f6ea4..0000000 --- a/tests/fixtures/feature_types/out/intersection/poly_to_clipping.geojson +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#978713", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#ffffff", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0.25, - 0.25 - ], - [ - 1, - 0.25 - ], - [ - 1, - 1 - ], - [ - 0.25, - 1 - ], - [ - 0.25, - 0.25 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/intersection/poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/intersection/poly_with_hole_to_clipping.geojson deleted file mode 100644 index f76e7f7..0000000 --- a/tests/fixtures/feature_types/out/intersection/poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#978713", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#ffffff", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0.25, - 0.4 - ], - [ - 0.4, - 0.4 - ], - [ - 0.4, - 0.25 - ], - [ - 1, - 0.25 - ], - [ - 1, - 1 - ], - [ - 0.25, - 1 - ], - [ - 0.25, - 0.4 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/union/multi_poly_to_clipping.geojson b/tests/fixtures/feature_types/out/union/multi_poly_to_clipping.geojson deleted file mode 100644 index da2c348..0000000 --- a/tests/fixtures/feature_types/out/union/multi_poly_to_clipping.geojson +++ /dev/null @@ -1,69 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#25856a", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#521199", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/union/multi_poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/union/multi_poly_with_hole_to_clipping.geojson deleted file mode 100644 index 6323e80..0000000 --- a/tests/fixtures/feature_types/out/union/multi_poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,99 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#3a8b1f", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#36744f", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.4, - 0.2 - ], - [ - 0.4, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 0.4 - ], - [ - 0.2, - 0.4 - ], - [ - 0.2, - 0.2 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/union/poly_to_clipping.geojson b/tests/fixtures/feature_types/out/union/poly_to_clipping.geojson deleted file mode 100644 index 2822ad1..0000000 --- a/tests/fixtures/feature_types/out/union/poly_to_clipping.geojson +++ /dev/null @@ -1,53 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#5b1199", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#97109a", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/union/poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/union/poly_with_hole_to_clipping.geojson deleted file mode 100644 index 071242e..0000000 --- a/tests/fixtures/feature_types/out/union/poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,83 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#5b1199", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#97109a", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.4, - 0.2 - ], - [ - 0.4, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 0.4 - ], - [ - 0.2, - 0.4 - ], - [ - 0.2, - 0.2 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/xor/multi_poly_to_clipping.geojson b/tests/fixtures/feature_types/out/xor/multi_poly_to_clipping.geojson deleted file mode 100644 index d1abcd3..0000000 --- a/tests/fixtures/feature_types/out/xor/multi_poly_to_clipping.geojson +++ /dev/null @@ -1,119 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#25856a", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#521199", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ], - [ - [ - [ - 0.25, - 1 - ], - [ - 1, - 1 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ] - ] - ], - [ - [ - [ - 2, - 2.75 - ], - [ - 2.75, - 2.75 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/xor/multi_poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/xor/multi_poly_with_hole_to_clipping.geojson deleted file mode 100644 index 1104888..0000000 --- a/tests/fixtures/feature_types/out/xor/multi_poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,157 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#3a8b1f", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#36744f", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.4, - 0.25 - ], - [ - 0.4, - 0.4 - ], - [ - 0.25, - 0.4 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.4, - 0.2 - ], - [ - 0.4, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 0.4 - ], - [ - 0.2, - 0.4 - ], - [ - 0.2, - 0.2 - ] - ] - ], - [ - [ - [ - 0.25, - 1 - ], - [ - 1, - 1 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2 - ], - [ - 2, - 2 - ], - [ - 2, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ] - ] - ], - [ - [ - [ - 2, - 2.75 - ], - [ - 2.75, - 2.75 - ], - [ - 2.75, - 2 - ], - [ - 3, - 2 - ], - [ - 3, - 3 - ], - [ - 2, - 3 - ], - [ - 2, - 2.75 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/xor/poly_to_clipping.geojson b/tests/fixtures/feature_types/out/xor/poly_to_clipping.geojson deleted file mode 100644 index b27a90f..0000000 --- a/tests/fixtures/feature_types/out/xor/poly_to_clipping.geojson +++ /dev/null @@ -1,79 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#978713", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#ffffff", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ] - ], - [ - [ - [ - 0.25, - 1 - ], - [ - 1, - 1 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/out/xor/poly_with_hole_to_clipping.geojson b/tests/fixtures/feature_types/out/xor/poly_with_hole_to_clipping.geojson deleted file mode 100644 index 226a31a..0000000 --- a/tests/fixtures/feature_types/out/xor/poly_with_hole_to_clipping.geojson +++ /dev/null @@ -1,117 +0,0 @@ -{ - "type": "Feature", - "properties": { - "stroke": "#978713", - "stroke-width": 2, - "stroke-opacity": 1, - "fill": "#ffffff", - "fill-opacity": 0.5 - }, - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 0.25 - ], - [ - 0.4, - 0.25 - ], - [ - 0.4, - 0.4 - ], - [ - 0.25, - 0.4 - ], - [ - 0.25, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.4, - 0.2 - ], - [ - 0.4, - 0.25 - ], - [ - 0.25, - 0.25 - ], - [ - 0.25, - 0.4 - ], - [ - 0.2, - 0.4 - ], - [ - 0.2, - 0.2 - ] - ] - ], - [ - [ - [ - 0.25, - 1 - ], - [ - 1, - 1 - ], - [ - 1, - 0.25 - ], - [ - 2.75, - 0.25 - ], - [ - 2.75, - 2.75 - ], - [ - 0.25, - 2.75 - ], - [ - 0.25, - 1 - ] - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/poly.geojson b/tests/fixtures/feature_types/poly.geojson deleted file mode 100644 index 25c4503..0000000 --- a/tests/fixtures/feature_types/poly.geojson +++ /dev/null @@ -1,31 +0,0 @@ -{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 0, - 1 - ], - [ - 1, - 1 - ], - [ - 1, - 0 - ], - [ - 0, - 0 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/feature_types/poly_with_hole.geojson b/tests/fixtures/feature_types/poly_with_hole.geojson deleted file mode 100644 index 5682393..0000000 --- a/tests/fixtures/feature_types/poly_with_hole.geojson +++ /dev/null @@ -1,53 +0,0 @@ -{ - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 1 - ], - [ - 0, - 0 - ] - ], - [ - [ - 0.2, - 0.2 - ], - [ - 0.2, - 0.4 - ], - [ - 0.4, - 0.4 - ], - [ - 0.4, - 0.2 - ], - [ - 0.2, - 0.2 - ] - ] - ] - } -} \ No newline at end of file diff --git a/tests/fixtures/generic_test_cases/basic1_poly.geojson b/tests/fixtures/generic_test_cases/basic1_poly.geojson new file mode 100644 index 0000000..740e8b4 --- /dev/null +++ b/tests/fixtures/generic_test_cases/basic1_poly.geojson @@ -0,0 +1,136 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [0, 0], + [0, 1], + [1, 1], + [1, 0], + [0, 0] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.25] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/tests/fixtures/generic_test_cases/basic2_poly_with_hole.geojson b/tests/fixtures/generic_test_cases/basic2_poly_with_hole.geojson new file mode 100644 index 0000000..0856ed5 --- /dev/null +++ b/tests/fixtures/generic_test_cases/basic2_poly_with_hole.geojson @@ -0,0 +1,169 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [0, 0], + [1, 0], + [1, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.2, 0.4], + [0.4, 0.4], + [0.4, 0.2], + [0.2, 0.2] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.4], + [0.4, 0.4], + [0.4, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.4] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.4, 0.2], + [0.4, 0.25], + [0.25, 0.25], + [0.25, 0.4], + [0.2, 0.4], + [0.2, 0.2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.4, 0.25], + [0.4, 0.2], + [0.2, 0.2], + [0.2, 0.4], + [0.25, 0.4], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.4, 0.25], + [0.4, 0.4], + [0.25, 0.4], + [0.25, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.4, 0.2], + [0.4, 0.25], + [0.25, 0.25], + [0.25, 0.4], + [0.2, 0.4], + [0.2, 0.2] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/tests/fixtures/generic_test_cases/basic3_multi_poly.geojson b/tests/fixtures/generic_test_cases/basic3_multi_poly.geojson new file mode 100644 index 0000000..1f57025 --- /dev/null +++ b/tests/fixtures/generic_test_cases/basic3_multi_poly.geojson @@ -0,0 +1,184 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [2, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.25] + ] + ], + [ + [ + [2, 2], + [2.75, 2], + [2.75, 2.75], + [2, 2.75], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [2, 2], + [2, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/tests/fixtures/generic_test_cases/basic4_multi_poly_with_hole.geojson b/tests/fixtures/generic_test_cases/basic4_multi_poly_with_hole.geojson new file mode 100644 index 0000000..9f4fb9b --- /dev/null +++ b/tests/fixtures/generic_test_cases/basic4_multi_poly_with_hole.geojson @@ -0,0 +1,217 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.2, 0.4], + [0.4, 0.4], + [0.4, 0.2], + [0.2, 0.2] + ] + ], + [ + [ + [2, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.4], + [0.4, 0.4], + [0.4, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.4] + ] + ], + [ + [ + [2, 2], + [2.75, 2], + [2.75, 2.75], + [2, 2.75], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.4, 0.2], + [0.4, 0.25], + [0.25, 0.25], + [0.25, 0.4], + [0.2, 0.4], + [0.2, 0.2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.4, 0.25], + [0.4, 0.2], + [0.2, 0.2], + [0.2, 0.4], + [0.25, 0.4], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.4, 0.25], + [0.4, 0.4], + [0.25, 0.4], + [0.25, 1], + [0, 1], + [0, 0] + ], + [ + [0.2, 0.2], + [0.4, 0.2], + [0.4, 0.25], + [0.25, 0.25], + [0.25, 0.4], + [0.2, 0.4], + [0.2, 0.2] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [2, 2], + [2, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/tests/src/feature_type_test.rs b/tests/src/feature_type_test.rs deleted file mode 100644 index be22e18..0000000 --- a/tests/src/feature_type_test.rs +++ /dev/null @@ -1,65 +0,0 @@ -use super::helper::{fixture_multi_polygon, fixture_polygon}; -use geo::Polygon; -use geo_booleanop::boolean::BooleanOp; - -fn assert_clipping(subject: &F, clipping: &Polygon, expected_name: &str) -where - F: BooleanOp>, -{ - { - let result = subject.intersection(clipping); - let expected = fixture_multi_polygon(format!("feature_types/out/intersection/{}", expected_name).as_str()); - - assert_eq!(result, expected); - } - { - let result = subject.difference(clipping); - let expected = fixture_multi_polygon(format!("feature_types/out/difference/{}", expected_name).as_str()); - - assert_eq!(result, expected); - } - { - let result = subject.union(clipping); - let expected = fixture_multi_polygon(format!("feature_types/out/union/{}", expected_name).as_str()); - - assert_eq!(result, expected); - } - { - let result = subject.xor(clipping); - let expected = fixture_multi_polygon(format!("feature_types/out/xor/{}", expected_name).as_str()); - - assert_eq!(result, expected); - } -} - -#[test] -fn test_poly() { - let clipping = fixture_polygon("feature_types/clipping_poly.geojson"); - let poly = fixture_polygon("feature_types/poly.geojson"); - - assert_clipping(&poly, &clipping, "poly_to_clipping.geojson") -} - -#[test] -fn test_poly_with_hole() { - let clipping = fixture_polygon("feature_types/clipping_poly.geojson"); - let poly = fixture_polygon("feature_types/poly_with_hole.geojson"); - - assert_clipping(&poly, &clipping, "poly_with_hole_to_clipping.geojson") -} - -#[test] -fn test_multi_poly() { - let clipping = fixture_polygon("feature_types/clipping_poly.geojson"); - let poly = fixture_multi_polygon("feature_types/multi_poly.geojson"); - - assert_clipping(&poly, &clipping, "multi_poly_to_clipping.geojson") -} - -#[test] -fn test_multi_poly_with_hole() { - let clipping = fixture_polygon("feature_types/clipping_poly.geojson"); - let poly = fixture_multi_polygon("feature_types/multi_poly_with_hole.geojson"); - - assert_clipping(&poly, &clipping, "multi_poly_with_hole_to_clipping.geojson") -} diff --git a/tests/src/lib.rs b/tests/src/lib.rs index 7f9db5d..17ce95c 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,6 +1,4 @@ #[cfg(test)] -mod feature_type_test; -#[cfg(test)] mod fill_queue_test; #[cfg(test)] mod generic_test_cases;