]> granicus.if.org Git - postgis/commitdiff
Added GEOS/JTS provided functions test
authorSandro Santilli <strk@keybit.net>
Tue, 1 Mar 2005 11:41:36 +0000 (11:41 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 1 Mar 2005 11:41:36 +0000 (11:41 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1454 b70326c6-7e19-0410-871a-916f4a2858ee

regress/regress_ogc.sql [new file with mode: 0644]
regress/regress_ogc_expected [new file with mode: 0644]
regress/run_ogc_regress [new file with mode: 0755]

diff --git a/regress/regress_ogc.sql b/regress/regress_ogc.sql
new file mode 100644 (file)
index 0000000..f62f482
--- /dev/null
@@ -0,0 +1,29 @@
+SELECT 'buffer', astext(buffer('POINT(0 0)', 1, 2));
+SELECT 'geomunion', astext(geomunion('POINT(0 0)', 'POINT(1 1)'));
+SELECT 'convexhull', asewkt(convexhull('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
+SELECT 'relate', relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)');
+SELECT 'relate', relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)', 'F0FFFF*02');
+SELECT 'relate', relate('POINT(0 0)', 'LINESTRING(0 0, 1 1)', 'F0FFF0*02');
+SELECT 'disjoint', disjoint('POINT(0 0)', 'LINESTRING(0 0, 1 1)');
+SELECT 'touches', touches('LINESTRING(0 10, 0 -10)', 'LINESTRING(0 0, 1 1)');
+SELECT 'intersects', intersects('LINESTRING(0 10, 0 -10)', 'LINESTRING(0 0, 1 1)');
+SELECT 'crosses', crosses('LINESTRING(0 10, 0 -10)', 'LINESTRING(0 0, 1 1)');
+SELECT 'crosses', crosses('LINESTRING(0 10, 0 -10)', 'LINESTRING(-4 0, 1 1)');
+SELECT 'within', within('POINT(5 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'within', within('POINT(0 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'within', within('POINT(-1 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'contains', contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))','POINT(-1 0)');
+SELECT 'contains', contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))','POINT(0 0)');
+SELECT 'contains', contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))','POINT(5 5)');
+SELECT 'overlaps', overlaps('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))','POINT(5 5)');
+SELECT 'isvalid', isvalid('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'isvalid', isvalid('POLYGON((0 0, 0 10, 10 10, -5 10, 10 0, 0 0))');
+SELECT 'intersection', astext(intersection('LINESTRING(0 10, 0 -10)', 'LINESTRING(0 0, 1 1)'));
+SELECT 'difference', astext(difference('LINESTRING(0 10, 0 -10)', 'LINESTRING(0 2, 0 -2)'));
+SELECT 'boundary', astext(boundary('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
+SELECT 'symdifference', astext(symdifference('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))', 'LINESTRING(0 0, 20 20)'));
+SELECT 'issimple', issimple('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))');
+SELECT 'equals', equals('LINESTRING(0 0, 1 1)', 'LINESTRING(1 1, 0 0)');
+SELECT 'pointonsurface', astext(pointonsurface('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
+SELECT 'centroid', astext(centroid('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2))'));
+
diff --git a/regress/regress_ogc_expected b/regress/regress_ogc_expected
new file mode 100644 (file)
index 0000000..a9db32d
--- /dev/null
@@ -0,0 +1,28 @@
+buffer|POLYGON((1 0,0.707106781186547 -0.707106781186547,1e-16 -1,-0.707106781186547 -0.707106781186547,-1 -1e-16,-0.707106781186548 0.707106781186547,-2e-16 1,0.707106781186547 0.707106781186548,1 0))
+geomunion|MULTIPOINT(0 0,1 1)
+convexhull|POLYGON((0 0,0 10,10 10,10 0,0 0))
+relate|F0FFFF102
+relate|t
+relate|f
+disjoint|f
+touches|t
+intersects|t
+crosses|f
+crosses|t
+within|f
+within|f
+within|f
+contains|f
+contains|f
+contains|t
+overlaps|f
+isvalid|t
+isvalid|f
+intersection|POINT(0 0)
+difference|MULTILINESTRING((0 10,0 2),(0 -2,0 -10))
+boundary|MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))
+symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,2 4,2 2,4 2,4 4)))
+issimple|t
+equals|t
+pointonsurface|POINT(5 5)
+centroid|POINT(5.08333333333333 5.08333333333333)
diff --git a/regress/run_ogc_regress b/regress/run_ogc_regress
new file mode 100755 (executable)
index 0000000..15c53b8
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+echo "Running OGC Regression Test..."
+echo 
+echo "       expected:'<'     obtained:'>'"
+echo
+
+DB=postgis_reg
+createdb $DB > /dev/null
+createlang plpgsql $DB > /dev/null
+psql -f ../lwpostgis.sql $DB > /dev/null 2>&1
+psql -tA < regress_ogc.sql $DB 2>&1 | grep -v INSERT > regress_ogc_out
+diff regress_ogc_expected regress_ogc_out
+sleep 1
+dropdb $DB > /dev/null