[postgis-tickets] r16032 - Include label in changes detection test of TopoGeo_addLinestring

Sandro Santilli strk at kbt.io
Sat Oct 21 06:43:22 PDT 2017


Author: strk
Date: 2017-10-21 06:43:21 -0700 (Sat, 21 Oct 2017)
New Revision: 16032

Modified:
   trunk/topology/test/regress/topogeo_addlinestring.sql
   trunk/topology/test/regress/topogeo_addlinestring_expected
Log:
Include label in changes detection test of TopoGeo_addLinestring

Modified: trunk/topology/test/regress/topogeo_addlinestring.sql
===================================================================
--- trunk/topology/test/regress/topogeo_addlinestring.sql	2017-10-21 09:08:32 UTC (rev 16031)
+++ trunk/topology/test/regress/topogeo_addlinestring.sql	2017-10-21 13:43:21 UTC (rev 16032)
@@ -12,7 +12,7 @@
 
 -- Check changes since last saving, save more
 -- {
-CREATE OR REPLACE FUNCTION check_changes()
+CREATE OR REPLACE FUNCTION check_changes(lbl text)
 RETURNS TABLE (o text)
 AS $$
 DECLARE
@@ -20,14 +20,15 @@
   sql text;
 BEGIN
   -- Check effect on nodes
-  sql := 'SELECT n.node_id, ''N|'' || n.node_id || ''|'' ||
+  sql := 'SELECT $1 || ''|N|'' || n.node_id || ''|'' ||
         COALESCE(n.containing_face::text,'''') || ''|'' ||
         ST_AsText(ST_SnapToGrid(n.geom, 0.2))::text as xx
   	FROM city_data.node n WHERE n.node_id > (
     		SELECT max FROM city_data.limits WHERE what = ''node''::text )
   		ORDER BY n.node_id';
 
-  FOR rec IN EXECUTE sql LOOP
+  FOR rec IN EXECUTE sql USING ( lbl )
+  LOOP
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
@@ -36,7 +37,7 @@
   sql := '
   WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
-  SELECT ''E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node :: text as xx
+  SELECT $1 || ''|E|'' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node :: text as xx
    FROM city_data.edge e, node_limits nl, edge_limits el
    WHERE e.start_node > nl.max
       OR e.end_node > nl.max
@@ -44,7 +45,8 @@
   ORDER BY e.edge_id;
   ';
 
-  FOR rec IN EXECUTE sql LOOP
+  FOR rec IN EXECUTE sql USING ( lbl )
+  LOOP
     o := rec.xx;
     RETURN NEXT;
   END LOOP;
@@ -64,70 +66,70 @@
 
 -- Isolated edge in universal face
 SELECT 'iso_uni', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(36 26, 38 30)');
-SELECT check_changes();
+SELECT check_changes('iso_uni');
 
 -- Isolated edge in face 5
 SELECT 'iso_f5', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(37 20, 43 19, 41 16)');
-SELECT check_changes();
+SELECT check_changes('iso_f5');
 
 -- Existing isolated edge
 SELECT 'iso_ex', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(36 26, 38 30)');
-SELECT check_changes();
+SELECT check_changes('iso_ex');
 
 -- Existing isolated edge within tolerance
 SELECT 'iso_ex_tol', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(36 27, 38 31)', 2);
-SELECT check_changes();
+SELECT check_changes('iso_ex_tol');
 
 -- Existing non-isolated edge
 SELECT 'noniso_ex', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 6, 35 14)');
-SELECT check_changes();
+SELECT check_changes('noniso_ex');
 
 -- Existing non-isolated edge within tolerance
 SELECT 'noniso_ex_tol', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 7, 35 13)', 2);
-SELECT check_changes();
+SELECT check_changes('noniso_ex_tol');
 
 -- Fully contained
 SELECT 'contained', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(35 8, 35 12)');
-SELECT check_changes();
+SELECT check_changes('contained');
 
 -- Overlapping
 SELECT 'overlap', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(45 22, 49 22)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('overlap');
 
 -- Crossing
 SELECT 'cross', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(49 18, 44 17)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('cross');
 
 -- Snapping (and splitting a face)
 SELECT 'snap', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(18 22.2, 22.5 22.2, 21.2 20.5)', 1) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('snap');
 SELECT 'snap_again', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(18 22.2, 22.5 22.2, 21.2 20.5)', 1) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('snap_again');
 
 -- A mix of crossing and overlapping, splitting another face
 SELECT 'crossover', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('crossover');
 SELECT 'crossover_again', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(9 18, 9 20, 21 10, 21 7)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('crossover_again');
 
 -- Fully containing
 SELECT 'contains', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(14 34, 13 35, 10 35, 9 35, 7 36)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('contains');
 
 -- Crossing a node
 SELECT 'nodecross', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(18 37, 22 37)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('nodecross');
 
 -- Existing isolated edge with 2 segments
 SELECT 'iso_ex_2segs', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(37 20, 43 19, 41 16)');
-SELECT check_changes();
+SELECT check_changes('iso_ex_2segs');
 
 -- See http://trac.osgeo.org/postgis/attachment/ticket/1613
 
 SELECT '#1613.1', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(556267.562954 144887.066638, 556267 144887.4)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1613.1');
 SELECT '#1613.2', TopoGeo_addLineString('city_data', 'SRID=4326;LINESTRING(556250 144887, 556267 144887.07, 556310.04 144887)') ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1613.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -142,11 +144,11 @@
 SELECT '#1631.1', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(556267.56295432 144887.06663814,556267.566 144888)'
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1631.1');
 SELECT '#1631.2', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(556254.67 144886.62, 556267.66 144887.07)'
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1631.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -160,13 +162,13 @@
 SELECT '#1641.1', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)'
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1641.1');
 -- Use a tolerance
 SELECT '#1641.2', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(0.095989 0.113619, -0.064646 0.470149)'
   , 1e-16
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1641.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -179,11 +181,11 @@
 SELECT '#1641.3', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(-0.223586 0.474301, 0.142550 0.406124)'
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1641.3');
 SELECT '#1641.4', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(0.095989 0.113619, -0.064646 0.470149)'
 ) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1641.4');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -197,12 +199,12 @@
 SELECT '#1650.2' || TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(0 0, 0 1)'
 , 2)::text;
-SELECT check_changes();
+SELECT check_changes('#1650.2');
 
 SELECT '#1650.3', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(-1 0, 10 0)'
 , 2) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1650.3');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -214,11 +216,11 @@
 DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1654.1', 'N', ST_AddIsoNode('city_data', 0, 'SRID=4326;POINT(0 0)');
-SELECT check_changes();
+SELECT check_changes('#1654.1');
 SELECT '#1654.2', TopoGeo_addLineString('city_data',
   'SRID=4326;LINESTRING(-10 1, 10 1)'
 , 2) ORDER BY 2;
-SELECT check_changes();
+SELECT check_changes('#1654.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -231,12 +233,12 @@
 
 SELECT '#1706.1', 'E', TopoGeo_AddLineString('city_data',
  'SRID=4326;LINESTRING(20 10, 10 10, 9 12, 10 20)');
-SELECT check_changes();
+SELECT check_changes('#1706.1');
 
 SELECT '#1706.2', 'E*', TopoGeo_addLineString('city_data',
  'SRID=4326;LINESTRING(10 0, 10 10, 15 10, 20 10)'
 , 4) ORDER BY 3;
-SELECT check_changes();
+SELECT check_changes('#1706.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
@@ -248,18 +250,18 @@
 DELETE FROM city_data.face where face_id > 0;
 
 SELECT '#1714.1', 'N', AddNode('city_data', 'SRID=4326;POINT(10 0)', false, true);
-SELECT check_changes();
+SELECT check_changes('#1714.1');
 
 SELECT '#1714.2', 'E*', TopoGeo_addLineString('city_data',
  'SRID=4326;LINESTRING(10 0, 0 20, 0 0, 10 0)'
 , 12) ORDER BY 3;
-SELECT check_changes();
+SELECT check_changes('#1714.2');
 
 -- Consistency check
 SELECT * FROM ValidateTopology('city_data');
 
 -- Cleanups
-DROP FUNCTION check_changes();
+DROP FUNCTION check_changes(text);
 SELECT DropTopology('city_data');
 DELETE FROM spatial_ref_sys where srid = 4326;
 

Modified: trunk/topology/test/regress/topogeo_addlinestring_expected
===================================================================
--- trunk/topology/test/regress/topogeo_addlinestring_expected	2017-10-21 09:08:32 UTC (rev 16031)
+++ trunk/topology/test/regress/topogeo_addlinestring_expected	2017-10-21 13:43:21 UTC (rev 16032)
@@ -10,52 +10,52 @@
 ERROR:  Invalid geometry type (POINT) passed to TopoGeo_AddLinestring, expected LINESTRING
 ERROR:  No topology with name "invalid" in topology.topology
 iso_uni|27
-N|23||POINT(36 26)
-N|24||POINT(38 30)
-E|27|sn23|en24
+iso_uni|N|23||POINT(36 26)
+iso_uni|N|24||POINT(38 30)
+iso_uni|E|27|sn23|en24
 iso_f5|28
-N|25||POINT(37 20)
-N|26||POINT(41 16)
-E|28|sn25|en26
+iso_f5|N|25||POINT(37 20)
+iso_f5|N|26||POINT(41 16)
+iso_f5|E|28|sn25|en26
 iso_ex|27
 iso_ex_tol|27
 noniso_ex|18
 noniso_ex_tol|18
 contained|29
-N|27||POINT(35 8)
-N|28||POINT(35 12)
-E|18|sn10|en27
-E|29|sn27|en28
-E|30|sn28|en13
+contained|N|27||POINT(35 8)
+contained|N|28||POINT(35 12)
+contained|E|18|sn10|en27
+contained|E|29|sn27|en28
+contained|E|30|sn28|en13
 overlap|31
 overlap|32
-N|29||POINT(49 22)
-N|30||POINT(45 22)
-E|8|sn18|en30
-E|31|sn19|en29
-E|32|sn30|en19
+overlap|N|29||POINT(49 22)
+overlap|N|30||POINT(45 22)
+overlap|E|8|sn18|en30
+overlap|E|31|sn19|en29
+overlap|E|32|sn30|en19
 cross|34
 cross|35
-N|31||POINT(49 18)
-N|32||POINT(47 17.6)
-N|33||POINT(44 17)
-E|15|sn12|en32
-E|33|sn32|en19
-E|34|sn31|en32
-E|35|sn32|en33
+cross|N|31||POINT(49 18)
+cross|N|32||POINT(47 17.6)
+cross|N|33||POINT(44 17)
+cross|E|15|sn12|en32
+cross|E|33|sn32|en19
+cross|E|34|sn31|en32
+cross|E|35|sn32|en33
 snap|7
 snap|36
 snap|39
-N|34||POINT(18 22)
-N|35||POINT(22.4 22)
-N|36||POINT(21 20.4)
-E|6|sn16|en34
-E|7|sn17|en35
-E|19|sn14|en36
-E|36|sn34|en17
-E|37|sn35|en18
-E|38|sn36|en17
-E|39|sn35|en36
+snap|N|34||POINT(18 22)
+snap|N|35||POINT(22.4 22)
+snap|N|36||POINT(21 20.4)
+snap|E|6|sn16|en34
+snap|E|7|sn17|en35
+snap|E|19|sn14|en36
+snap|E|36|sn34|en17
+snap|E|37|sn35|en18
+snap|E|38|sn36|en17
+snap|E|39|sn35|en36
 snap_again|7
 snap_again|36
 snap_again|39
@@ -63,21 +63,21 @@
 crossover|44
 crossover|45
 crossover|46
-N|37||POINT(9 20)
-N|38||POINT(16.2 14)
-N|39||POINT(21 10)
-N|40||POINT(9 18)
-N|41||POINT(21 7)
-E|9|sn15|en38
-E|20|sn9|en41
-E|21|sn15|en40
-E|40|sn37|en16
-E|41|sn38|en14
-E|42|sn37|en38
-E|43|sn39|en14
-E|44|sn38|en39
-E|45|sn40|en37
-E|46|sn41|en39
+crossover|N|37||POINT(9 20)
+crossover|N|38||POINT(16.2 14)
+crossover|N|39||POINT(21 10)
+crossover|N|40||POINT(9 18)
+crossover|N|41||POINT(21 7)
+crossover|E|9|sn15|en38
+crossover|E|20|sn9|en41
+crossover|E|21|sn15|en40
+crossover|E|40|sn37|en16
+crossover|E|41|sn38|en14
+crossover|E|42|sn37|en38
+crossover|E|43|sn39|en14
+crossover|E|44|sn38|en39
+crossover|E|45|sn40|en37
+crossover|E|46|sn41|en39
 crossover_again|42
 crossover_again|44
 crossover_again|45
@@ -85,98 +85,98 @@
 contains|25
 contains|47
 contains|48
-N|42||POINT(7 36)
-N|43||POINT(14 34)
-E|47|sn21|en42
-E|48|sn43|en22
+contains|N|42||POINT(7 36)
+contains|N|43||POINT(14 34)
+contains|E|47|sn21|en42
+contains|E|48|sn43|en22
 nodecross|49
 nodecross|50
-N|44||POINT(18 37)
-N|45||POINT(22 37)
-E|49|sn44|en4
-E|50|sn4|en45
+nodecross|N|44||POINT(18 37)
+nodecross|N|45||POINT(22 37)
+nodecross|E|49|sn44|en4
+nodecross|E|50|sn4|en45
 iso_ex_2segs|28
 #1613.1|51
-N|46||POINT(556267.6 144887)
-N|47||POINT(556267 144887.4)
-E|51|sn46|en47
+#1613.1|N|46||POINT(556267.6 144887)
+#1613.1|N|47||POINT(556267 144887.4)
+#1613.1|E|51|sn46|en47
 #1613.2|53
 #1613.2|54
-N|48||POINT(556250 144887)
-N|49||POINT(556267.6 144887)
-N|50||POINT(556310 144887)
-E|51|sn46|en49
-E|52|sn49|en47
-E|53|sn48|en49
-E|54|sn49|en50
+#1613.2|N|48||POINT(556250 144887)
+#1613.2|N|49||POINT(556267.6 144887)
+#1613.2|N|50||POINT(556310 144887)
+#1613.2|E|51|sn46|en49
+#1613.2|E|52|sn49|en47
+#1613.2|E|53|sn48|en49
+#1613.2|E|54|sn49|en50
 #1631.1|55
-N|51||POINT(556267.6 144887)
-N|52||POINT(556267.6 144888)
-E|55|sn51|en52
+#1631.1|N|51||POINT(556267.6 144887)
+#1631.1|N|52||POINT(556267.6 144888)
+#1631.1|E|55|sn51|en52
 #1631.2|56
 #1631.2|57
-N|53||POINT(556254.6 144886.6)
-N|54||POINT(556267.6 144887)
-E|56|sn53|en51
-E|57|sn51|en54
+#1631.2|N|53||POINT(556254.6 144886.6)
+#1631.2|N|54||POINT(556267.6 144887)
+#1631.2|E|56|sn53|en51
+#1631.2|E|57|sn51|en54
 #1641.1|58
-N|55||POINT(-0.2 0.4)
-N|56||POINT(0.2 0.4)
-E|58|sn55|en56
+#1641.1|N|55||POINT(-0.2 0.4)
+#1641.1|N|56||POINT(0.2 0.4)
+#1641.1|E|58|sn55|en56
 #1641.2|60
 #1641.2|61
-N|57||POINT(0 0.2)
-N|58||POINT(0 0.4)
-N|59||POINT(0 0.4)
-E|58|sn55|en58
-E|59|sn58|en56
-E|60|sn57|en58
-E|61|sn58|en59
+#1641.2|N|57||POINT(0 0.2)
+#1641.2|N|58||POINT(0 0.4)
+#1641.2|N|59||POINT(0 0.4)
+#1641.2|E|58|sn55|en58
+#1641.2|E|59|sn58|en56
+#1641.2|E|60|sn57|en58
+#1641.2|E|61|sn58|en59
 #1641.3|62
-N|60||POINT(-0.2 0.4)
-N|61||POINT(0.2 0.4)
-E|62|sn60|en61
+#1641.3|N|60||POINT(-0.2 0.4)
+#1641.3|N|61||POINT(0.2 0.4)
+#1641.3|E|62|sn60|en61
 #1641.4|64
 #1641.4|65
-N|62||POINT(0 0.2)
-N|63||POINT(0 0.4)
-N|64||POINT(0 0.4)
-E|62|sn60|en63
-E|63|sn63|en61
-E|64|sn62|en63
-E|65|sn63|en64
+#1641.4|N|62||POINT(0 0.2)
+#1641.4|N|63||POINT(0 0.4)
+#1641.4|N|64||POINT(0 0.4)
+#1641.4|E|62|sn60|en63
+#1641.4|E|63|sn63|en61
+#1641.4|E|64|sn62|en63
+#1641.4|E|65|sn63|en64
 #1650.1
-N|65|0|POINT(0 0)
+#1650.2|N|65|0|POINT(0 0)
 #1650.3|66
-N|66||POINT(10 0)
-E|66|sn65|en66
+#1650.3|N|66||POINT(10 0)
+#1650.3|E|66|sn65|en66
 #1654.1|N|67
-N|67|0|POINT(0 0)
+#1654.1|N|67|0|POINT(0 0)
 #1654.2|67
 #1654.2|68
-N|68||POINT(-10 1)
-N|69||POINT(10 1)
-E|67|sn68|en67
-E|68|sn67|en69
+#1654.2|N|68||POINT(-10 1)
+#1654.2|N|69||POINT(10 1)
+#1654.2|E|67|sn68|en67
+#1654.2|E|68|sn67|en69
 #1706.1|E|69
-N|70||POINT(20 10)
-N|71||POINT(10 20)
-E|69|sn70|en71
+#1706.1|N|70||POINT(20 10)
+#1706.1|N|71||POINT(10 20)
+#1706.1|E|69|sn70|en71
 #1706.2|E*|69
 #1706.2|E*|71
 #1706.2|E*|72
-N|72||POINT(10 0)
-N|73||POINT(10 10)
-N|74||POINT(15 10)
-E|69|sn70|en74
-E|70|sn73|en71
-E|71|sn72|en73
-E|72|sn74|en73
+#1706.2|N|72||POINT(10 0)
+#1706.2|N|73||POINT(10 10)
+#1706.2|N|74||POINT(15 10)
+#1706.2|E|69|sn70|en74
+#1706.2|E|70|sn73|en71
+#1706.2|E|71|sn72|en73
+#1706.2|E|72|sn74|en73
 #1714.1|N|75
-N|75|0|POINT(10 0)
+#1714.1|N|75|0|POINT(10 0)
 #1714.2|E*|73
-N|76||POINT(0 20)
-E|73|sn75|en76
+#1714.2|N|76||POINT(0 20)
+#1714.2|E|73|sn75|en76
 Topology 'city_data' dropped
 t3280.start|t
 t3280|L11



More information about the postgis-tickets mailing list