spot/src/tgbatest/randaut.test
Alexandre Duret-Lutz 1e7c1e5cdd bin: implement --output for automata
Fixes #56.

* src/bin/common_aoutput.cc, src/bin/common_aoutput.hh,
src/bin/dstar2tgba.cc: Implement it.
* src/bin/autfilt.cc, src/bin/ltl2tgba.cc, src/bin/ltldo.cc,
src/bin/randaut.cc: Fix main() to catch exceptions from the
constructor of the automaton printer as well.
* src/tgbatest/randaut.test: Add a test case.
* doc/org/oaut.org: Document it.
2015-02-15 12:32:12 +01:00

83 lines
2.5 KiB
Bash
Executable file

#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
randaut=../../bin/randaut
autfilt=../../bin/autfilt
$randaut --spin -S4 a b | ../ltl2tgba -H -XN - >out
grep 'States: 4' out
grep 'AP: 2' out
grep 'state-acc' out
grep 'Acceptance: 1' out
$randaut -n 3 --hoa -S5..9 -A1..3 3 >out
test `grep -c 'States: [5-9]$' out` = 3
test `grep -c 'Acceptance: [1-3] ' out` = 3
test `grep -c 'AP: 3 ' out` = 3
$randaut --spin -A2 3 2>stderr && exit 1
grep 'spin.*incompatible' stderr
$randaut --spin -A0 3 # should work
$randaut --ba -A2 3 2>stderr && exit 1
grep 'ba.*incompatible' stderr
$randaut --ba -A0 3 2>stderr && exit 1
grep 'ba.*incompatible' stderr
$randaut --states 10..20 2 -n 100 -H > aut.hoa
a=`$autfilt --states=..14 -c <aut.hoa`
b=`$autfilt aut.hoa --states=15.. -c`
test `expr $a + $b` = 100
# The count of SCCs and edges might change if the
# algorithm or its default values are changed. Do
# not hesitate to adjust the expected values below.
$randaut -n 5 --name='%F-%L-%s-%c-%e' -H a | grep '^name' >out
cat >expected<<EOF
name: "0-0-10-1-29"
name: "0-1-10-1-30"
name: "0-2-10-1-29"
name: "0-3-10-3-24"
name: "0-4-10-1-29"
EOF
diff out expected
$randaut -n 5 --stats='name: "%F-%L-%s-%c-%e"' a >out2
diff out2 expected
$randaut -n 5 --dot=@ a 2>stderr && exit 1
grep 'randaut: unknown option.*@' stderr
$randaut -n -1 -S2 2 -H | $autfilt -H --is-deterministic -n 3 -o out.hoa
$randaut -n -1 -S2 2 -H | $autfilt -H -v --is-deterministic -n 4 -o '>>out.hoa'
$autfilt -H out.hoa -o 'out-det%d.hoa'
$autfilt -H out.hoa -o '>>out-det%d.hoa'
test 8 = `$autfilt -c out-det0.hoa`
test 6 = `$autfilt -c out-det1.hoa`
$autfilt -H out.hoa -o foo -c 2>stderr && exit 1
grep 'autfilt: options --output and --count are incompatible' stderr