stud

study spacejunk
Log | Files | Refs | LICENSE

commit 4a32d2f7ded04b326d59713845a47b2aa10115db (tree)
parent 7a7c0ad72b7ecebd316959dd652a5a6349c627a7
Author: Motiejus Jakštys <motiejus@uber.com>
Date:   Thu, 15 Apr 2021 15:47:17 +0300

selfcrossing-1 and selfcrossing-1-rev tests

Diffstat:
MIV/tests.sql | 25+++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/IV/tests.sql b/IV/tests.sql @@ -135,13 +135,15 @@ end $$ language plpgsql; do $$ declare + fig6 constant text default 'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)'; + selfcrossing1 constant text default 'LINESTRING(-27 180,-20 166,-13 176,-18 184)'; vcrossings geometry[]; mutated boolean; begin select (self_crossing(array((select way from wm_debug where stage='cinflections' and name='fig6')))).* into vcrossings, mutated; perform assert_equals(true, mutated); perform assert_equals( - 'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)', + fig6, (select st_astext( st_linemerge(st_union(way)) ) from (select unnest(vcrossings) way) a) @@ -150,7 +152,7 @@ begin select (self_crossing(array((select way from wm_debug where stage='cinflections' and name='fig6-rev')))).* into vcrossings, mutated; perform assert_equals(true, mutated); perform assert_equals( - 'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)', + fig6, (select st_astext( st_translate(st_reverse(st_linemerge(st_union(way))), -60, 0) ) from (select unnest(vcrossings) way) a) @@ -165,4 +167,23 @@ begin ) from (select unnest(vcrossings) way) a) ); + + select (self_crossing(array((select way from wm_debug where stage='cinflections' and name='selfcrossing-1' and gen=1)))).* into vcrossings, mutated; + perform assert_equals(true, mutated); + perform assert_equals( + selfcrossing1, + (select st_astext( + st_linemerge(st_union(way)) + ) from (select unnest(vcrossings) way) a) + ); + + select (self_crossing(array((select way from wm_debug where stage='cinflections' and name='selfcrossing-1-rev')))).* into vcrossings, mutated; + perform assert_equals(true, mutated); + perform assert_equals( + selfcrossing1, + (select st_astext( + st_translate(st_reverse(st_linemerge(st_union(way))), -60, 0) + ) from (select unnest(vcrossings) way) a) + ); + end $$ language plpgsql;