]> granicus.if.org Git - postgis/commitdiff
Put tests for ST_AddIsoEdge in their own file. Fix use of ! rather than "not" for...
authorSandro Santilli <strk@keybit.net>
Mon, 23 May 2011 12:33:12 +0000 (12:33 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 23 May 2011 12:33:12 +0000 (12:33 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7211 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/sqlmm.sql
topology/test/Makefile
topology/test/regress/sqlmm.sql
topology/test/regress/sqlmm_expected
topology/test/regress/st_addisoedge.sql [new file with mode: 0644]
topology/test/regress/st_addisoedge_expected [new file with mode: 0644]

index c1e4aa5e8901ebf7cf10fa22a068ee1d0acfcbd0..c397c13ea78fa44acf7eccf3e9727f86b13f55b5 100644 (file)
@@ -1611,7 +1611,7 @@ BEGIN
                --
                -- Check acurve to be within face
                --
-               IF ! ST_Within(acurve, face) THEN
+               IF NOT ST_Within(acurve, face) THEN
        RAISE EXCEPTION
        'SQL/MM Spatial exception - geometry not within face.';
                END IF;
index 51c0e539acb48ac27eb164d1372a65b3323ab037..1779ab394a8199f88bd0fa52c9c9b62b96620208 100644 (file)
@@ -28,6 +28,7 @@ TESTS = regress/legacy_validate.sql regress/legacy_predicate.sql \
        regress/addedge.sql regress/addface.sql \
        regress/addface2.5d.sql \
        regress/polygonize.sql \
+       regress/st_addisoedge.sql \
        regress/st_addedgenewfaces.sql \
        regress/st_getfacegeometry.sql \
        regress/st_getfaceedges.sql \
index 2af11f62ce27288ebc355a8e2221da6ec60f0b29..08a61f45dfd5ce61fa8d6b18dab10bf1e5ac4119 100644 (file)
@@ -1,9 +1,5 @@
 set client_min_messages to WARNING;
 
---
---
-SELECT topology.DropTopology('sqlmm_topology');
-
 -- 
 -- ST_InitTopoGeo
 -- 
@@ -158,3 +154,5 @@ SELECT topology.ST_RemoveIsoEdge('sqlmm_topology', 1);
 
 SELECT '-- ST_NewEdgesSplit  ---------------------';
 SELECT topology.ST_NewEdgesSplit('sqlmm_topology', 2, 'POINT(10 2)');
+
+SELECT topology.DropTopology('sqlmm_topology');
index d75b5870d99cae0f4791c2a8a52280fd77ae8eba..a3472bc7fe22d00d4415f19a9036ca2b8387dcb3 100644 (file)
@@ -1,4 +1,3 @@
-Topology 'sqlmm_topology' dropped
 Topology-Geometry 'sqlmm_topology' (id:4) created. 
 -- ST_AddIsoNode ------------------------
 ERROR:  SQL/MM Spatial exception - null argument
@@ -54,3 +53,4 @@ ERROR:  SQL/MM Spatial exception - invalid point
 Isolated edge 1 removed
 -- ST_NewEdgesSplit  ---------------------
 9
+Topology 'sqlmm_topology' dropped
diff --git a/topology/test/regress/st_addisoedge.sql b/topology/test/regress/st_addisoedge.sql
new file mode 100644 (file)
index 0000000..fe44849
--- /dev/null
@@ -0,0 +1,54 @@
+set client_min_messages to WARNING;
+
+SELECT topology.CreateTopology('sqlmm_topology') > 0;
+
+-- Put some points in
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(0 0)') RETURNING 'N' || node_id; -- 1
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(10 0)') RETURNING 'N' || node_id; -- 2
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(5 0)') RETURNING 'N' || node_id; -- 3
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(5 10)') RETURNING 'N' || node_id; -- 4
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(10 10)') RETURNING 'N' || node_id; -- 5
+INSERT INTO sqlmm_topology.node (containing_face, geom) VALUES
+  (0, 'POINT(20 10)') RETURNING 'N' || node_id; -- 6
+
+-- null input
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, NULL);
+SELECT topology.ST_AddIsoEdge(NULL, 1, 2, 'LINESTRING(0 0, 1 1)');
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, NULL, 'LINESTRING(0 0, 1 1)');
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', NULL, 2, 'LINESTRING(0 0, 1 1)');
+
+-- invalid curve
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'POINT(0 0)');
+
+-- non-simple curve
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 10 0, 5 5, 5 -5)');
+
+-- non-existing nodes
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 10000, 2, 'LINESTRING(0 0, 1 1)');
+
+-- Curve endpoints mismatch
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 1 1)');
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 1, 10 0)');
+
+-- Node crossing 
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 10 0)');
+
+-- Good ones
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 4, 5, 'LINESTRING(5 10, 5 9, 10 10)');
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 2 1, 10 5, 10 0)');
+
+-- Not isolated edge (shares endpoint with previous)
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 4, 6, 'LINESTRING(5 10, 10 9, 20 10)');
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 5, 6, 'LINESTRING(10 10, 20 10)');
+
+-- Edge intersection (geometry intersects an edge)
+SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 2 20, 10 0)');
+
+-- on different faces (TODO req. nodes contained in face)
+
+SELECT topology.DropTopology('sqlmm_topology');
diff --git a/topology/test/regress/st_addisoedge_expected b/topology/test/regress/st_addisoedge_expected
new file mode 100644 (file)
index 0000000..16963d8
--- /dev/null
@@ -0,0 +1,23 @@
+t
+N1
+N2
+N3
+N4
+N5
+N6
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - null argument
+ERROR:  SQL/MM Spatial exception - invalid curve
+ERROR:  SQL/MM Spatial exception - curve not simple
+ERROR:  SQL/MM Spatial exception - non-existent node
+ERROR:  SQL/MM Spatial exception - end node not geometry end point.
+ERROR:  SQL/MM Spatial exception - start node not geometry start point.
+ERROR:  SQL/MM Spatial exception - geometry crosses a node
+1
+2
+ERROR:  SQL/MM Spatial exception - not isolated node
+ERROR:  SQL/MM Spatial exception - not isolated node
+ERROR:  SQL/MM Spatial exception - not isolated node
+Topology 'sqlmm_topology' dropped