more elaborate test cases

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:45 +03:00 committed by Motiejus Jakštys
parent 35d9a5a4f5
commit cc345c703a
3 changed files with 15 additions and 13 deletions

7
db
View File

@ -40,12 +40,7 @@ case ${1:-} in
stop) stop)
docker stop "$name" docker stop "$name"
;; ;;
"" | --) *)
[[ $# -gt 1 ]] && shift
_psql "$@" _psql "$@"
;; ;;
*)
>&2 echo "Unknown command: '$*'"
exit 1
;;
esac esac

View File

@ -21,7 +21,14 @@ do $$
declare declare
bends geometry[]; bends geometry[];
begin begin
perform assert_equals(3, array_length(detect_bends((select way from figures where name='fig3')), 1)); select detect_bends((select way from figures where name='fig3')) into bends;
perform assert_equals(3, array_length(bends, 1));
perform assert_equals(4::bigint, (select count(1) from (select (st_dumppoints(detect_bends[1])).path from bends) a));
perform assert_equals('LINESTRING(12 0,13 4,20 2,20 0)', st_astext(bends[1]));
perform assert_equals('LINESTRING(20 2,20 0,32 0,33 10)', st_astext(bends[2]));
perform assert_equals('LINESTRING(32 0,33 10,38 16,43 15,44 10,44 0)',st_astext(bends[3]));
perform assert_equals(3, array_length(detect_bends((select way from figures where name='fig3-1')), 1)); perform assert_equals(3, array_length(detect_bends((select way from figures where name='fig3-1')), 1));
select detect_bends((select way from figures where name='fig5')) into bends; select detect_bends((select way from figures where name='fig5')) into bends;

6
wm.sql
View File

@ -45,9 +45,9 @@ begin
end end
$$ language plpgsql; $$ language plpgsql;
-- fix_gentle_inflections moves bend endpoints following "Gentle Inflection at
-- fix_gentle_inflections moves bend endpoints in case of gentle inflections -- End of a Bend" section.
create or replace function fix_gentle_inflections(line geometry) returns table(bend geometry) as $$ create or replace function fix_gentle_inflections(INOUT bends geometry[]) as $$
begin begin
end end
$$ language plpgsql; $$ language plpgsql;