]> granicus.if.org Git - postgis/commitdiff
Regression test for ST_isValidDetail (including "ESRI" flag) [RT-SIGTA]
authorSandro Santilli <strk@keybit.net>
Wed, 16 Feb 2011 08:54:03 +0000 (08:54 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 16 Feb 2011 08:54:03 +0000 (08:54 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6826 b70326c6-7e19-0410-871a-916f4a2858ee

regress/Makefile.in
regress/isvaliddetail.sql [new file with mode: 0644]
regress/isvaliddetail_expected [new file with mode: 0644]

index 3d293a4ee2a227b43ec721d1e129d197292726a0..1f4071d6365ba525eaa477c3d63adb250ddac3c5 100644 (file)
@@ -73,7 +73,8 @@ TESTS = \
        wmsservers_new \
        tickets \
        remove_repeated_points \
-       split
+       split \
+       isvaliddetail
 
 # TESTS += wmsservers_old
 # Styled buffer only if GEOS >= 3.2
diff --git a/regress/isvaliddetail.sql b/regress/isvaliddetail.sql
new file mode 100644 (file)
index 0000000..552ae1c
--- /dev/null
@@ -0,0 +1,41 @@
+select 1, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail('LINESTRING (70 250, 190 340)')).*
+) foo;
+
+select 2, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail('LINESTRING (70 250, 70 250)')).*
+) foo;
+
+-- Twisted polygon 
+select 3, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail(
+'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))'
+  )).*
+) foo;
+
+-- Twisted polygon is also invalid for ESRI
+select 4, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail(
+'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))'
+  ,
+  1 -- ESRI flag
+  )).*
+) foo;
+
+-- Self-touching ring forming hole
+select 5, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail(
+'POLYGON ((70 250, 40 500, 100 400, 70 250, 80 350, 60 350, 70 250))'
+  ,
+  0 -- No flags
+  )).*
+) foo;
+
+-- Self-touching ring forming hole with ESRI flag
+select 6, valid, reason, st_astext(location) FROM (
+  SELECT (ST_IsValidDetail(
+'POLYGON ((70 250, 40 500, 100 400, 70 250, 80 350, 60 350, 70 250))'
+  ,
+  1 -- ESRI flag
+  )).*
+) foo;
diff --git a/regress/isvaliddetail_expected b/regress/isvaliddetail_expected
new file mode 100644 (file)
index 0000000..50a057c
--- /dev/null
@@ -0,0 +1,6 @@
+1|t||
+2|f|Too few points in geometry component|POINT(70 250)
+3|f|Self-intersection|POINT(70 400)
+4|f|Self-intersection|POINT(70 400)
+5|f|Ring Self-intersection|POINT(70 250)
+6|t||