1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 17:39:34 +02:00
cae-tools/poly2d/test/hsort

97 lines
1.9 KiB
Plaintext
Raw Normal View History

#!/bin/sh
. ./Common
###############################################################################
tst "hierarchical sort with one hole" <<EOF
struct p2d *pl, *p;
pl = p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(20, 0));
p2d_append(p, v2d_new(20, 10));
p2d_append(p, v2d_new(0, 10));
p2d_close(p);
p = p->next = p2d_new();
p2d_append(p, v2d_new(2, 2));
p2d_append(p, v2d_new(2, 8));
p2d_append(p, v2d_new(18, 8));
p2d_append(p, v2d_new(18, 2));
p2d_close(p);
print_hier(p2d_hsort(pl));
EOF
expect <<EOF
0 0 20 0 20 10 0 10
2 2 2 8 18 8 18 2
EOF
#------------------------------------------------------------------------------
tst "hierarchical sort with two holes" <<EOF
struct p2d *pl, *p;
pl = p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(10, 0));
p2d_append(p, v2d_new(10, 10));
p2d_close(p);
p = p->next = p2d_new();
p2d_append(p, v2d_new(2, 2));
p2d_append(p, v2d_new(4, 2));
p2d_append(p, v2d_new(4, 4));
p2d_close(p);
p = p->next = p2d_new();
p2d_append(p, v2d_new(6, 2));
p2d_append(p, v2d_new(8, 2));
p2d_append(p, v2d_new(8, 8));
p2d_close(p);
print_hier(p2d_hsort(pl));
EOF
expect <<EOF
0 0 10 0 10 10
2 2 4 2 4 4
6 2 8 2 8 8
EOF
#------------------------------------------------------------------------------
tst "hierarchical sort with nested holes" <<EOF
struct p2d *pl, *p;
pl = p = p2d_new();
p2d_append(p, v2d_new(0, 0));
p2d_append(p, v2d_new(10, 0));
p2d_append(p, v2d_new(10, 10));
p2d_close(p);
p = p->next = p2d_new();
p2d_append(p, v2d_new(2, 2));
p2d_append(p, v2d_new(8, 2));
p2d_append(p, v2d_new(8, 8));
p2d_close(p);
p = p->next = p2d_new();
p2d_append(p, v2d_new(3, 3));
p2d_append(p, v2d_new(7, 3));
p2d_append(p, v2d_new(7, 7));
p2d_close(p);
print_hier(p2d_hsort(pl));
EOF
expect <<EOF
0 0 10 0 10 10
2 2 8 2 8 8
3 3 7 3 7 7
EOF
###############################################################################