spot/src/ltltest/parseerr.test
Alexandre Duret-Lutz 83de4264cb * src/sanity/80columns.test: New file.
* src/sanity/Makefile.am (check-local): Run it.
* src/ltltest/equals.test, src/ltltest/lunabbrev.test,
src/ltltest/nenoform.test, src/ltltest/parseerr.test
src/ltltest/tunabbrev.test, src/ltlvisit/forminf.cc,
src/tgbatest/explpro2.test, src/tgbatest/explpro3.test,
src/tgbatest/explprod.test, src/tgbatest/spotlbtt.test,
src/tgbatest/tripprod.test: Wrap long lines.
2004-05-10 17:18:27 +00:00

76 lines
2.3 KiB
Bash
Executable file

#! /bin/sh
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# 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 2 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 Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Check error recovery in parsing. This also checks how the
# resulting tree looks like.
. ./defs || exit 1
check()
{
run 1 ./ltl2text "$1" >stdout
if test -n "$2"; then
echo "$2" >expect
else
: >expect
fi
if cmp stdout expect; then
:
else
echo "'$1' parsed as"
cat stdout
echo "instead of"
cat expect
rm -f stdout expect
exit 1
fi
}
# Empty or unparsable strings
check '' ''
check '+' ''
check '/2/3/4/5 a + b /6/7/8/' ''
# leading and trailing garbage are skipped
check 'a U b c' 'binop(U, AP(a), AP(b))'
check 'a &&& b' 'multop(And, constant(0), AP(b))'
# (check multop merging while we are at it)
check 'a & b & c & d e' 'multop(And, AP(a), AP(b), AP(c), AP(d))'
check 'a & (b | c) & d should work' \
'multop(And, AP(a), multop(Or, AP(b), AP(c)), AP(d))'
# Binop recovery
check 'a U' 'constant(0)'
check 'a U b V c R' 'constant(0)'
# Recovery inside parentheses
check 'a U (b c) U e R (f g <=> h)' \
'binop(R, binop(U, binop(U, AP(a), constant(0)), AP(e)), constant(0))'
check 'a U ((c) U e) R (<=> f g)' \
'binop(R, binop(U, AP(a), binop(U, AP(c), AP(e))), constant(0))'
# Missing parentheses
check 'a & (a + b' 'multop(And, AP(a), multop(Or, AP(a), AP(b)))'
check 'a & (a + b c' 'multop(And, constant(0), AP(a))'
check 'a & (+' 'multop(And, constant(0), AP(a))'
check 'a & (' 'multop(And, constant(0), AP(a))'