test/bugs: add regression tests for p2d_no_intersect and angle_3 bugs

That's commits 84f9d3c3b4
and 7ca942d0e9
This commit is contained in:
Werner Almesberger 2015-01-18 20:57:09 -03:00
parent 149fc262ff
commit ae8d393859
1 changed files with 40 additions and 0 deletions

40
poly2d/test/bugs Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
. ./Common
###############################################################################
tst "bug: p2d_no_intersect could wrap around and bite itself" <<EOF
struct p2d *p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(1, 27.8058649225));
p2d_append(p, v2d_new(1, 2));
p2d_close(p);
p2d_area(p, 3, 3);
EOF
expect <<EOF
EOF
#------------------------------------------------------------------------------
tst "bug: collinear path segments tripped angle_3" <<EOF
struct p2d *p = p2d_new();
struct p2d *q;
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(1, 27.8058649225));
p2d_append(p, v2d_new(1, 2.0947540869));
p2d_append(p, v2d_new(1, 2));
p2d_close(p);
q = p2d_area(p, 3, 3);
p2d_write_gnuplot_all(stdout, q);
EOF
# Not output since the polygon is too small. This did not cause the above bug
# but just happened to be a property of the problem polygon.
expect <<EOF
EOF
###############################################################################