1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 21:58:38 +02:00
cae-tools/poly2d/test/make

62 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
. ./Common
###############################################################################
tst "make an open polygon" <<EOF
struct p2d *p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(1, 2));
p2d_write_gnuplot(stdout, p);
EOF
expect <<EOF
0 0
1 2
EOF
#------------------------------------------------------------------------------
tst "make a closed polygon" <<EOF
struct p2d *p = p2d_new();
p2d_append(p, v2d_new(-1, 1));
p2d_append(p, v2d_new(3, 7));
p2d_close(p);
p2d_write_gnuplot(stdout, p);
EOF
expect <<EOF
-1 1
3 7
-1 1
EOF
#------------------------------------------------------------------------------
tst "make two open polygons" <<EOF
struct p2d *p = p2d_new();
struct p2d *q = p2d_new();
p2d_append(p, v2d_new(1, 4));
p2d_append(p, v2d_new(2, 8));
p->next = q;
p2d_append(q, v2d_new(3, 15));
p2d_append(q, v2d_new(4, 16));
p2d_write_gnuplot_all(stdout, p);
EOF
expect <<EOF
1 4
2 8
3 15
4 16
EOF
###############################################################################