Rewrite test for ST_AddIsoNode (see #1503)

git-svn-id: http://svn.osgeo.org/postgis/trunk@8942 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2012-01-27 11:05:44 +00:00
parent 636925915a
commit 3334012a59
2 changed files with 73 additions and 112 deletions

View file

@ -1,75 +1,53 @@
set client_min_messages to WARNING;
\set VERBOSITY terse
select topology.CreateTopology('tt', -1) > 0;
-- Usual city_data input
select 'ST_AddIsoNode: test NULL exceptions';
--
select topology.ST_AddIsoNode(NULL, 0, 'POINT(1 4)');
select topology.ST_AddIsoNode('tt', 0, NULL);
select topology.ST_AddIsoNode('tt', NULL, NULL);
select topology.ST_AddIsoNode(NULL, NULL, NULL);
--
select 'ST_AddIsoNode: test wrong topology name';
--
select topology.ST_AddIsoNode('wrong_name', 0, 'POINT(1 4)');
--
select 'ST_AddIsoNode: test negative idface';
--
select topology.ST_AddIsoNode('tt', -1, 'POINT(1 4)');
--
select 'ST_AddIsoNode: test wrong idface';
--
select topology.ST_AddIsoNode('tt', 1, 'POINT(1 4)');
--
select 'ST_AddIsoNode: test smart creation ISO Node (without know idface)';
--
select topology.ST_AddIsoNode('tt', NULL, 'POINT(1 4)');
--
select 'ST_AddIsoNode: test coincident nodes';
--
select topology.ST_AddIsoNode('tt', 0, 'POINT(1 4)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(1 4)');
select topology.ST_AddIsoNode('tt', 1, 'POINT(1 4)');
--
select 'ST_AddIsoNode: test add a node in UniverseFace';
--
select topology.ST_AddIsoNode('tt', 0, 'POINT(2 2)');
--
select 'ST_AddIsoNode - prepare to test the creation inside a face';
--
select topology.DropTopology('tt');
select topology.CreateTopology('tt', -1) > 0;
select topology.ST_AddIsoNode('tt', NULL, 'POINT(1 1)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(5 2)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(4 6)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(0 4)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(2 2)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(4 3)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(3 5)');
select topology.ST_AddIsoNode('tt', NULL, 'POINT(1 3)');
select count(*) from tt.node where containing_face<>0;
select count(*) from tt.node where containing_face is null;
INSERT INTO tt.face (face_id, mbr) VALUES (2, '010300000001000000050000000000000000000000000000000000F03F00000000000000000000000000001840000000000000144000000000000018400000000000001440000000000000F03F0000000000000000000000000000F03F');
INSERT INTO tt.face (face_id, mbr) VALUES (3, '01030000000100000005000000000000000000F03F0000000000000040000000000000F03F00000000000014400000000000001040000000000000144000000000000010400000000000000040000000000000F03F0000000000000040');
BEGIN;
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (1, 1, 2, 2, 2, -4, 4, 2, 0, '010200000002000000000000000000F03F000000000000F03F00000000000014400000000000000040');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (2, 2, 3, 3, 3, -1, 1, 2, 0, '0102000000020000000000000000001440000000000000004000000000000010400000000000001840');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (3, 3, 4, 4, 4, -2, 2, 2, 0, '0102000000020000000000000000001040000000000000184000000000000000000000000000001040');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (4, 4, 1, 1, 1, -3, 3, 2, 0, '01020000000200000000000000000000000000000000001040000000000000F03F000000000000F03F');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (5, 5, 6, 6, 6, -8, 8, 3, 2, '0102000000020000000000000000000040000000000000004000000000000010400000000000000840');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (6, 6, 7, 7, 7, -5, 5, 3, 2, '0102000000020000000000000000001040000000000000084000000000000008400000000000001440');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (7, 7, 8, 8, 8, -6, 6, 3, 2, '01020000000200000000000000000008400000000000001440000000000000F03F0000000000000840');
INSERT INTO tt.edge_data (edge_id, start_node, end_node, next_left_edge, abs_next_left_edge, next_right_edge, abs_next_right_edge, left_face, right_face, geom) VALUES (8, 8, 5, 5, 5, -7, 7, 3, 2, '010200000002000000000000000000F03F000000000000084000000000000000400000000000000040');
END;
--
select 'ST_AddIsoNode: test a node inside a hole';
--
select topology.ST_AddIsoNode('tt', NULL, 'POINT(3 3)');
select count(*) from tt.node where node_id=9 AND containing_face=3;
--
select 'ST_AddIsoNode: test a node inside a face';
--
select topology.ST_AddIsoNode('tt', NULL, 'POINT(4 5)');
select count(*) from tt.node where node_id=10 AND containing_face=2;
--
select topology.DropTopology('tt');
\i load_topology.sql
-- NULL exceptions
select ST_AddIsoNode(NULL, 0, 'POINT(1 4)');
select ST_AddIsoNode('tt', 0, NULL);
select ST_AddIsoNode('tt', NULL, NULL);
select ST_AddIsoNode(NULL, NULL, NULL);
-- Wrong topology name
select ST_AddIsoNode('wrong_name', 0, 'POINT(1 4)');
select ST_AddIsoNode('', 0, 'POINT(1 4)');
-- Negative idface';
select ST_AddIsoNode('city_data', -1, 'POINT(1 4)');
-- Wrong idface
select ST_AddIsoNode('city_data', 5, 'POINT(5 33)'); -- in face 9
select ST_AddIsoNode('city_data', 9, 'POINT(39 18)'); -- in face 5
-- Coincident nodes';
select ST_AddIsoNode('city_data', 0, 'POINT(21 22)');
select ST_AddIsoNode('city_data', NULL, 'POINT(21 22)');
select ST_AddIsoNode('city_data', 1, 'POINT(21 22)');
-- Smart creation ISO Node (without know idface)';
-- in face 5
select 1 as id, ST_AddIsoNode('city_data', NULL, 'POINT(39 18)') as n
into nn;
insert into nn -- in universe
select '2', ST_AddIsoNode('city_data', NULL, 'POINT(50 18)');
insert into nn -- in face 9
select '3', ST_AddIsoNode('city_data', NULL, 'POINT(5 33)');
-- Explicit face
insert into nn -- in face 5
select '4', ST_AddIsoNode('city_data', 5, 'POINT(42 18)');
insert into nn -- in universe
select '5', ST_AddIsoNode('city_data', 0, 'POINT(50 17)');
insert into nn -- in face 9
select '6', ST_AddIsoNode('city_data', 9, 'POINT(5 32)');
SELECT 'T'||t.id, n.node_id, n.containing_face FROM nn t, city_data.node n
WHERE t.n = n.node_id ORDER BY t.id;
-- TODO: test for bug #1503
--SELECT 'T5', st_addisonode('city_data', 22, 'POINT(28.5 32.5)');
DROP TABLE nn;
select topology.DropTopology('city_data');

View file

@ -1,42 +1,25 @@
t
ST_AddIsoNode: test NULL exceptions
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
ST_AddIsoNode: test wrong topology name
ERROR: SQL/MM Spatial exception - invalid topology name
ST_AddIsoNode: test negative idface
ERROR: SQL/MM Spatial exception - not within face
ST_AddIsoNode: test wrong idface
ERROR: SQL/MM Spatial exception - not within face
ST_AddIsoNode: test smart creation ISO Node (without know idface)
1
ST_AddIsoNode: test coincident nodes
ERROR: SQL/MM Spatial exception - coincident node
ERROR: SQL/MM Spatial exception - coincident node
ERROR: SQL/MM Spatial exception - coincident node
ST_AddIsoNode: test add a node in UniverseFace
2
ST_AddIsoNode - prepare to test the creation inside a face
Topology 'tt' dropped
t
1
2
3
4
5
6
7
8
0
0
BEGIN
COMMIT
ST_AddIsoNode: test a node inside a hole
t
9
1
ST_AddIsoNode: test a node inside a face
10
1
Topology 'tt' dropped
22
26
COMMIT
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 topology name
ERROR: zero-length delimited identifier at or near """" at character 21
ERROR: SQL/MM Spatial exception - not within face
ERROR: SQL/MM Spatial exception - not within face
ERROR: SQL/MM Spatial exception - not within face
ERROR: SQL/MM Spatial exception - coincident node
ERROR: SQL/MM Spatial exception - coincident node
ERROR: SQL/MM Spatial exception - coincident node
T1|23|5
T2|24|0
T3|25|9
T4|26|5
T5|27|0
T6|28|9
Topology 'city_data' dropped