Root/
| 1 | #!/bin/sh |
| 2 | . ./Common |
| 3 | |
| 4 | ############################################################################### |
| 5 | |
| 6 | tst "make an open polygon" <<EOF |
| 7 | struct p2d *p = p2d_new(); |
| 8 | |
| 9 | p2d_append(p, v2d_new(0, 0)); |
| 10 | p2d_append(p, v2d_new(1, 2)); |
| 11 | p2d_write_gnuplot(stdout, p); |
| 12 | EOF |
| 13 | |
| 14 | expect <<EOF |
| 15 | 0 0 |
| 16 | 1 2 |
| 17 | |
| 18 | EOF |
| 19 | |
| 20 | #------------------------------------------------------------------------------ |
| 21 | |
| 22 | tst "make a closed polygon" <<EOF |
| 23 | struct p2d *p = p2d_new(); |
| 24 | |
| 25 | p2d_append(p, v2d_new(-1, 1)); |
| 26 | p2d_append(p, v2d_new(3, 7)); |
| 27 | p2d_close(p); |
| 28 | p2d_write_gnuplot(stdout, p); |
| 29 | EOF |
| 30 | |
| 31 | expect <<EOF |
| 32 | -1 1 |
| 33 | 3 7 |
| 34 | -1 1 |
| 35 | |
| 36 | EOF |
| 37 | |
| 38 | #------------------------------------------------------------------------------ |
| 39 | |
| 40 | tst "make two open polygons" <<EOF |
| 41 | struct p2d *p = p2d_new(); |
| 42 | struct p2d *q = p2d_new(); |
| 43 | |
| 44 | p2d_append(p, v2d_new(1, 4)); |
| 45 | p2d_append(p, v2d_new(2, 8)); |
| 46 | p->next = q; |
| 47 | p2d_append(q, v2d_new(3, 15)); |
| 48 | p2d_append(q, v2d_new(4, 16)); |
| 49 | p2d_write_gnuplot_all(stdout, p); |
| 50 | EOF |
| 51 | |
| 52 | expect <<EOF |
| 53 | 1 4 |
| 54 | 2 8 |
| 55 | |
| 56 | 3 15 |
| 57 | 4 16 |
| 58 | |
| 59 | EOF |
| 60 | |
| 61 | ############################################################################### |
| 62 |
Branches:
master
