* tests/: Rename as... * tests/core/: ... this. * python/tests/: Rename as... * tests/python/: ... this. * python/tests/run.in: Move as... * tests/run.in: This, and adjust. * tests/Makefile.am: Adjust to run both core and python tests. * configure.ac, README, debian/python3-spot.examples, debian/rules, doc/org/tut.org, python/Makefile.am, spot/ltsmin/Makefile.am, spot/ltsmin/kripke.test, spot/sanity/ipynb.test: Adjust.
180 lines
3.9 KiB
Bash
Executable file
180 lines
3.9 KiB
Bash
Executable file
#!/bin/sh
|
|
# -*- coding: utf-8 -*-
|
|
# Copyright (C) 2012, 2013, 2014, 2015 Laboratoire de Recherche et
|
|
# Développement de l'Epita (LRDE).
|
|
#
|
|
# This file is part of Spot, a model checking library.
|
|
#
|
|
# Spot is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
# License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
. ./defs
|
|
|
|
set -e
|
|
|
|
for f in 'p0 U p1 U p2' 'Gp00 | Gp13 | Gp42' '{(1;1)*}[]->p1'
|
|
do
|
|
# Make sure Spot can read the LBTT it produces
|
|
run 0 ltl2tgba --lbtt "$f" > out
|
|
s=`wc -l < out`
|
|
if ltl2tgba -H "$f" | grep 'properties:.*state-acc'; then
|
|
head -n 1 out | grep t && exit 1
|
|
else
|
|
head -n 1 out | grep t
|
|
fi
|
|
run 0 autfilt --lbtt out > out2
|
|
s2=`wc -l < out2`
|
|
test "$s" -eq "$s2"
|
|
|
|
# The LBTT output use 2 lines par state, one line per transition,
|
|
# and one extra line for header.
|
|
run 0 ltl2tgba "$f" --stats 'expr %s \* 2 + %e + 1' > size
|
|
l=$(eval "$(cat size)")
|
|
test "$s" -eq "$l"
|
|
|
|
# Make sure we output the state-based format
|
|
# for BA...
|
|
run 0 ltl2tgba --ba --lbtt --low --any "$f" >out4
|
|
head -n 1 out4 | grep t && exit 1
|
|
s4=`wc -l < out4`
|
|
test "$s" -eq "$s4"
|
|
run 0 autfilt --lbtt out4 > out5
|
|
run 0 autfilt out4 --are-isomorphic out5
|
|
# ... unless --lbtt=t is used.
|
|
run 0 ltl2tgba --ba --lbtt=t --low --any "$f" >out6
|
|
head -n 1 out6 | grep t
|
|
s6=`wc -l < out6`
|
|
test "$s" -eq "$s6"
|
|
run 0 autfilt --lbtt out6 > out7
|
|
run 0 autfilt out6 --are-isomorphic out7
|
|
done
|
|
|
|
|
|
# multiple inputs (from different tools)
|
|
|
|
cat >input <<EOF
|
|
/* This is the output of 'lbt' on the formula 'U p0 p1'. */
|
|
4 1
|
|
0 1 -1
|
|
1 p0
|
|
2 p1
|
|
-1
|
|
1 0 -1
|
|
1 p0
|
|
2 p1
|
|
-1
|
|
2 0 0 -1
|
|
3 t
|
|
-1
|
|
3 0 0 -1
|
|
3 t
|
|
-1
|
|
/* This kind of output is returned by wring2lbtt, on the same formula.
|
|
(Newer versions of LBTT reject this input with missing new lines.) */
|
|
4 1 0 1 -1 1 p0
|
|
2 p1
|
|
-1 1 0 -1 1 p0
|
|
2 p1
|
|
-1 2 0 0 -1 3 t
|
|
-1 3 0 0 -1 3 t
|
|
-1
|
|
/* This is an automaton without state and three acceptance sets.
|
|
Spot is not able to deal with automata that do not have initial
|
|
state, so it will add a dummy state. */
|
|
0 3
|
|
/* Another example from wring2lbtt (or modella), showing that the
|
|
acceptance set of the states is not always numbered from 0. */
|
|
6 1 0 1 -1 1 | & ! p0 ! p1 & p0 ! p1
|
|
2 & ! p0 ! p1
|
|
3 | & p0 p1 & ! p0 p1
|
|
-1 1 0 -1 4 ! p1
|
|
-1 2 0 -1 2 & ! p0 ! p1
|
|
3 | & p0 p1 & ! p0 p1
|
|
-1 3 0 -1 5 t
|
|
-1 4 0 1 -1 4 ! p1
|
|
-1 5 0 1 -1 5 t
|
|
-1
|
|
/* this one show that state numbers do not always start from 0 */
|
|
1 1t
|
|
1 1
|
|
1 -1 !p0
|
|
1 0 -1 p0
|
|
-1
|
|
/* This is the output of 'lbt' on the formula 'U p0 p1', but with
|
|
states 1 and 2 changed to 100 and 200 */
|
|
4 1
|
|
0 1 -1
|
|
100 p0
|
|
200 p1
|
|
-1
|
|
100 0 -1
|
|
100 p0
|
|
200 p1
|
|
-1
|
|
200 0 0 -1
|
|
3 t
|
|
-1
|
|
3 0 0 -1
|
|
3 t
|
|
-1
|
|
/* This is the output of 'lbt' on the formula 'U p0 p1', but with
|
|
states 0 and 2 changed to 100 and 200. This make sure the renaming
|
|
also applies to the initial state.
|
|
*/
|
|
4 1
|
|
100 1 -1
|
|
1 p0
|
|
200 p1
|
|
-1
|
|
1 0 -1
|
|
1 p0
|
|
200 p1
|
|
-1
|
|
200 0 0 -1
|
|
3 t
|
|
-1
|
|
3 0 0 -1
|
|
3 t
|
|
-1
|
|
EOF
|
|
|
|
run 0 autfilt --stats '%s %t %e %a' input > output
|
|
cat >expected<<EOF
|
|
4 16 6 1
|
|
4 16 6 1
|
|
1 0 0 3
|
|
6 20 9 1
|
|
1 2 2 1
|
|
4 16 6 1
|
|
4 16 6 1
|
|
EOF
|
|
|
|
diff output expected
|
|
|
|
cat > input <<EOF
|
|
1 2t
|
|
0 1
|
|
0 -1 & ! "a" ! "b" !
|
|
0 0 -1 & "a" ! "b" /* comments are OK */
|
|
0 1 -1 & ! "a" /* here too */ "b"
|
|
0 0 1 -1 & "a" "b"
|
|
-1
|
|
EOF
|
|
cat >expected <<EOF
|
|
input:3.5-20: failed to parse guard: & ! "a" ! "b" !
|
|
input:3.20: syntax error, unexpected '!', expecting end of formula
|
|
input:3.20: ignoring trailing garbage
|
|
EOF
|
|
autfilt -q input 2> stderr && exit 1
|
|
cat stderr
|
|
diff stderr expected
|