Root/test/tsort

Source at commit 377b7f81193685f23c93546767a059e194419446 created 3 years 5 months ago.
By Werner Almesberger, fped.c: new option -m (for -p and -P) to suppress showing measurements
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_sed '/Aborted/d' <<EOF
130cycle detected in partial order
131EOF
132
133# The "Aborted" can be reported with or without "(core dumped)", and sometimes
134# not at all. So we just remove it. We already know that tsort has detected
135# the problem.
136
137###############################################################################
138

Archive Download this file

Branches:
master



interactive