#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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
ltlfilt=ltlfilt
randltl=randltl
genltl=genltl
# Some example formulas taken from Ruediger Ehlers's dbaminimizer
# http://react.cs.uni-saarland.de/tools/dbaminimizer
# which are expected to be processed by ltl2dstar.
cat >formulas <<'EOF'
& G F a G F b
X X a
G F e a X X b
G F e a X X X b
G i a X X X b
G F i a X X X b
& G i a F b G i b F c
G i a F b
& G i a F b G c
& & G ! c G i a F b G i b F c
& G i a F b G i c F d
& i G a F b i G ! a F ! b
& G i a F b G i ! a F ! b
U p & q X U r s
U p & q X & r F & s X F & u X F & v X F w
F & p X & q X F r
F & q X U p r
G i p U q r
F & p X F & q X F & r X F s
& & & & G F p G F q G F r G F s G F u
| | U p U q r U q U r p U r U p q
| | G F a G F b G F c
G F a
U a U b U c d
G U a U b U ! a ! b
EOF
# More examples taken from scheck's test suite.
# http://tcs.legacy.ics.tkk.fi/users/tlatvala/scheck/
cat >>formulas <> formulas
# Some examples from scalables formulas
$genltl --rv-counter=1..10 --go-theta=1..10 -l >> formulas
count=`wc -l < formulas`
test $count -eq 168
run 0 $ltlfilt --lbt-input formulas > formulas.2
run 0 $ltlfilt -l formulas.2 > formulas.3
run 0 $ltlfilt -l --lbt-input formulas > formulas.4
test `wc -l < formulas.2` -eq 168
test `wc -l < formulas.3` -eq 168
test `wc -l < formulas.4` -eq 168
run 0 $ltlfilt formulas.2 --csv-escape --format='%L,%f' > formulas.5
run 0 $ltlfilt formulas.5/2 --csv-escape --format='%L,%f' > formulas.6
cmp formulas.5 formulas.6
# Make sure ltl2dstar-style litterals always get quoted.
test "`$ltlfilt -l --lbt-input -f 'G F a'`" = 'G F "a"'
# Original lbt-style litterals are unquoted.
test "`$ltlfilt -l --lbt-input -f 'G F p42'`" = 'G F p42'