Root/test/tsort

Source at commit 39fef16d1c4629dfad5feed05e0faaf7f91d08ca created 13 years 11 months ago.
By werner, Got rid of the requirement to have a "package" directive. Fixed a grammar error found in the process. Also taught the regression test system a new trick: the path to "fped" can be passed in the environment variable FPED. E.g., FPED=fped.r5943 make test
1#!/bin/sh
2. ./Common
3
4###############################################################################
5
6fped "tsort: total order" <<EOF
7%tsort {
8    a b
9    a c
10    a d
11    b c
12    b d
13    c d
14}
15EOF
16expect <<EOF
17a
18b
19c
20d
21EOF
22
23#------------------------------------------------------------------------------
24
25fped "tsort: partial order change (1)" <<EOF
26%tsort {
27    a b
28    a c
29    a d
30    d b
31}
32EOF
33expect <<EOF
34a
35c
36d
37b
38EOF
39
40#------------------------------------------------------------------------------
41
42fped "tsort: partial order change (2)" <<EOF
43%tsort {
44    b c
45    c d
46    a b
47}
48EOF
49expect <<EOF
50a
51b
52c
53d
54EOF
55
56#------------------------------------------------------------------------------
57
58fped "tsort: old order differs from resolution order" <<EOF
59%tsort {
60    +a +b +c +d
61    a c
62    a b
63    a d
64}
65EOF
66expect <<EOF
67a
68b
69c
70d
71EOF
72
73#------------------------------------------------------------------------------
74
75fped "tsort: order change due to priority" <<EOF
76%tsort {
77    a b
78    a c 1
79    a d
80}
81EOF
82expect <<EOF
83a
84c
85b
86d
87EOF
88
89#------------------------------------------------------------------------------
90
91fped "tsort: priority accumulation without decay" <<EOF
92%tsort {
93    +a +b +c +d
94    a b 1
95    a d 1
96}
97EOF
98expect <<EOF
99a
100b
101d
102c
103EOF
104
105#------------------------------------------------------------------------------
106
107fped "tsort: priority accumulation with decay" <<EOF
108%tsort {
109    +a -b +c +d
110    a b 1
111    a d 1
112}
113EOF
114expect <<EOF
115a
116b
117c
118d
119EOF
120
121#------------------------------------------------------------------------------
122
123fped_fail "tsort: cycle" <<EOF
124%tsort {
125    a b
126    b a
127}
128EOF
129expect <<EOF
130cycle detected in partial order
131Aborted (core dumped)
132EOF
133
134# not entirely comfortable about the "Aborted (core dumped)". It's a system
135# message (from the shell) that may get mangled. Also, since few people keep
136# their cores these days, "(core dumped)" shouldn't really appear. Wonder why
137# it does. strace agrees that __WCOREFLAG is set ...
138
139###############################################################################
140

Archive Download this file

Branches:
master



interactive