From 5115599fab63bfed2b41509ab7b8fc9d30192621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 28 Feb 2021 15:15:27 +0200 Subject: [PATCH] simplify unit test structure --- IV/tests.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/IV/tests.sql b/IV/tests.sql index 09c7a95..851b28a 100644 --- a/IV/tests.sql +++ b/IV/tests.sql @@ -19,11 +19,11 @@ insert into figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39, insert into figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(110 24,114 20,133 20,145 15,145 0,136 5,123 7,114 7,111 2)')); -- DETECT BENDS -drop table if exists bends; +drop table if exists abends, bends; +create table abends (name text, ways geometry[]); +insert into abends select f.name, detect_bends(f.way) from figures f; create table bends (name text, way geometry); -insert into bends select 'fig3', unnest(detect_bends((select way from figures where name='fig3'))); -insert into bends select 'fig5', unnest(detect_bends((select way from figures where name='fig5'))); -insert into bends select 'inflection-1', unnest(detect_bends((select way from figures where name='inflection-1'))); +insert into bends select a.name, unnest(a.ways) from abends a; do $$ declare @@ -41,11 +41,11 @@ begin end $$ language plpgsql; -- FIX BEND INFLECTIONS -drop table if exists inflections; +drop table if exists ainflections, inflections; +create table ainflections (name text, ways geometry[]); +insert into ainflections select a.name, fix_gentle_inflections(a.ways) from abends a; create table inflections (name text, way geometry); -insert into inflections select 'fig3', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='fig3')))); -insert into inflections select 'fig5', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='fig5')))); -insert into inflections select 'inflection-1', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='inflection-1')))); +insert into inflections select a.name, unnest(a.ways) from ainflections a; do $$ declare