2010-04-27 00:30:21 +03:00
|
|
|
#!/bin/sh
|
|
|
|
. ./Common
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
fped "tsort: total order" <<EOF
|
|
|
|
%tsort {
|
|
|
|
a b
|
|
|
|
a c
|
|
|
|
a d
|
|
|
|
b c
|
|
|
|
b d
|
|
|
|
c d
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: partial order change (1)" <<EOF
|
|
|
|
%tsort {
|
|
|
|
a b
|
|
|
|
a c
|
|
|
|
a d
|
|
|
|
d b
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
c
|
|
|
|
d
|
|
|
|
b
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: partial order change (2)" <<EOF
|
|
|
|
%tsort {
|
|
|
|
b c
|
|
|
|
c d
|
|
|
|
a b
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: old order differs from resolution order" <<EOF
|
|
|
|
%tsort {
|
|
|
|
+a +b +c +d
|
|
|
|
a c
|
|
|
|
a b
|
|
|
|
a d
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: order change due to priority" <<EOF
|
|
|
|
%tsort {
|
|
|
|
a b
|
|
|
|
a c 1
|
|
|
|
a d
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
c
|
|
|
|
b
|
|
|
|
d
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: priority accumulation without decay" <<EOF
|
|
|
|
%tsort {
|
|
|
|
+a +b +c +d
|
|
|
|
a b 1
|
|
|
|
a d 1
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
d
|
|
|
|
c
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped "tsort: priority accumulation with decay" <<EOF
|
|
|
|
%tsort {
|
|
|
|
+a -b +c +d
|
|
|
|
a b 1
|
|
|
|
a d 1
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
expect <<EOF
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
fped_fail "tsort: cycle" <<EOF
|
|
|
|
%tsort {
|
|
|
|
a b
|
|
|
|
b a
|
|
|
|
}
|
|
|
|
EOF
|
2010-10-12 18:32:15 +03:00
|
|
|
expect_sed 's/Aborted.*/Aborted/' <<EOF
|
2010-04-27 00:30:21 +03:00
|
|
|
cycle detected in partial order
|
2010-10-12 18:32:15 +03:00
|
|
|
Aborted
|
2010-04-27 00:30:21 +03:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# not entirely comfortable about the "Aborted (core dumped)". It's a system
|
|
|
|
# message (from the shell) that may get mangled. Also, since few people keep
|
|
|
|
# their cores these days, "(core dumped)" shouldn't really appear. Wonder why
|
|
|
|
# it does. strace agrees that __WCOREFLAG is set ...
|
|
|
|
|
|
|
|
###############################################################################
|