selfcrossing-1 and selfcrossing-1-rev tests

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent d390d373a9
commit fd1250a73b

View File

@ -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;