#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2014, 2015, 2016 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 .
. ./defs
set -e
expecterr()
{
cat >$1.exp
autfilt --hoa "$@" 2>$1.err-t >$1.out && exit 1
test $? = 2
# If autfilt is compiled statically, the '.../lt-' parse of
# its name is not stripped, and the error message show the
# full path.
sed 's:^\.\./\.\./bin/::' $1.err-t >$1.err
cat $1.err
diff $1.err $1.exp
}
expectok()
{
cat >$1.exp
autfilt --hoa "$@" >$1.out
test $? = 0
cat $1.out
diff $1.out $1.exp
}
cat >input <input <input <input <input <input <input <input <input <input <input<input<input<input <input <input <stderr && exit 1
cat stderr
diff stderr input.exp
cat >expected <input <input < goto accept_all
:: (a) -> goto T0_init
fi;
accept_all:
skip
}
never {
start: if :: false -> goto T0 fi;
T0: false
}
EOF
expectok input <input <input <input <expected <stderr && exit 1
cat stderr
diff stderr input.exp
diff expected input.out
# Error recovery
cat >input <input < goto accept_init
fi;
}
EOF
autfilt input -H >output 2>&1 && exit 1
cat output
cat >expected <input <input <output.err
grep 'foob:1.1: Cannot open file foob' output.err
# Make sure we can read multiple automata from stdin
ltl2tgba 'a U b' 'GFa' --hoa | grep -v '^name:' > input
autfilt --hoa < input | autfilt --hoa > output
diff input output
# Parse something in debug mode, to exercise the %printer
cat >input < output.err
grep -- "--BODY--" output.err
grep "identifier.*v1" output.err
# This was generated by
# randaut -n 10 -Hl 3 -e 0.055 --seed=3 | fmt
cat > input <input <input <input < goto accept_all
:: ((a) && (!(b))) -> goto T0_init
fi;
accept_all: /* s0 */
skip
}
EOF
# ltl3ba 1.1.1 has a bug where it outputs
# Acceptance: 1 t
# when it meant
# Acceptance: 1 Inf(0)
# and a development version of our parser would
# incorrectly interpret the former as the latter.
cat >input < output
# 0 -> 0
# 1 -> removed
# 2 -> 1
# 3 -> removed
# 4 -> 2
# !2 -> 3
expectok input --cleanup-acc <out.hoa
ltl2tgba -C -Hi 'GFa & GFb & (c U d)' >out-i.hoa
autfilt -C -Hi out.hoa --name=%M >out-i2.hoa
diff -u out-i.hoa out-i2.hoa
sed 's/ stutter-invariant//;/properties:$/d' out-i3.hoa
autfilt --trust-hoa=no -C -Hi out.hoa --name=%M >out-i2.hoa
diff -u out-i3.hoa out-i2.hoa
cat >expected <bug<input <input <input <input <bigaut <