Rename tgbatest into tests.

* src/Makefile.am, README, configure.ac: update references.
* src/tgbatest/: rename as...
* src/tests/: ...this!
This commit is contained in:
Etienne Renault 2015-04-23 09:46:49 +02:00
parent 8c4a3c0125
commit bd57f7a991
99 changed files with 8 additions and 6 deletions

22
src/tests/.cvsignore Normal file
View file

@ -0,0 +1,22 @@
.deps
Makefile
Makefile.in
defs
explicit
.libs
tgbaread
readsave
ltl2tgba
ltlprod
bddprod
explprod
*.ps
*.dot
tripprod
mixprod
spotlbtt
ltlmagic
expldot
powerset
reduccmp
reductgba

41
src/tests/.gitignore vendored Normal file
View file

@ -0,0 +1,41 @@
acc
bddprod
bitvect
blue_counter
checkpsl
checkta
complement
defs
.deps
*.dot
eltl2tgba
emptchk
expldot
explicit
explicit2
explicit3
explprod
input
intvcomp
intvcmp2
.libs
ltl2tgba
ltlmagic
ltlprod
Makefile
Makefile.in
maskacc
mixprod
output1
output2
powerset
*.ps
randtgba
readsat
readsave
reduccmp
reductgba
spotlbtt
taatgba
tgbaread
tripprod

148
src/tests/Makefile.am Normal file
View file

@ -0,0 +1,148 @@
## -*- coding: utf-8 -*-
## Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de
## Recherche et Développement de l'Epita (LRDE).
## Copyright (C) 2003, 2004, 2005, 2006 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 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/>.
AM_CPPFLAGS = -I$(srcdir)/.. -I.. $(BUDDY_CPPFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
LDADD = ../libspot.la
# These are the most used test programs, and they are also useful
# to run manually outside the test suite. Always build them.
noinst_PROGRAMS = ltl2tgba randtgba
check_SCRIPTS = defs
# Keep this sorted alphabetically.
check_PROGRAMS = \
acc \
bitvect \
complement \
checkpsl \
checkta \
emptchk \
intvcomp \
intvcmp2 \
ltlprod \
readsat \
taatgba
# Keep this sorted alphabetically.
acc_SOURCES = acc.cc
bitvect_SOURCES = bitvect.cc
checkpsl_SOURCES = checkpsl.cc
checkta_SOURCES = checkta.cc
complement_SOURCES = complementation.cc
emptchk_SOURCES = emptchk.cc
intvcomp_SOURCES = intvcomp.cc
intvcmp2_SOURCES = intvcmp2.cc
ltl2tgba_SOURCES = ltl2tgba.cc
ltlprod_SOURCES = ltlprod.cc
randtgba_SOURCES = randtgba.cc
readsat_SOURCES = readsat.cc
taatgba_SOURCES = taatgba.cc
# Keep this sorted by STRENGTH. Test basic things first,
# because such failures will be easier to diagnose and fix.
TESTS = $(TESTS_twa)
TESTS_twa = \
acc.test \
acc2.test \
intvcomp.test \
bitvect.test \
ltlcross3.test \
taatgba.test \
renault.test \
nondet.test \
det.test \
neverclaimread.test \
hoaparse.test \
complete.test \
remfin.test \
dstar.test \
readsave.test \
ltldo.test \
ltldo2.test \
maskacc.test \
maskkeep.test \
simdet.test \
sim2.test \
ltl2tgba.test \
ltl2neverclaim.test \
ltl2neverclaim-lbtt.test \
ltlprod.test \
explprod.test \
explpro2.test \
explpro3.test \
explpro4.test \
tripprod.test \
dupexp.test \
exclusive-tgba.test \
remprop.test \
degendet.test \
degenid.test \
degenlskip.test \
kv.test \
randomize.test \
lbttparse.test \
scc.test \
sccdot.test \
sccsimpl.test \
dbacomp.test \
obligation.test \
wdba.test \
wdba2.test \
babiak.test \
monitor.test \
dra2dba.test \
ltlcross4.test \
ltl2dstar.test \
ltl2dstar2.test \
ltl2dstar3.test \
ltl2ta.test \
ltl2ta2.test \
randaut.test \
randtgba.test \
isomorph.test \
uniq.test \
sbacc.test \
stutter-tgba.test \
emptchk.test \
emptchke.test \
dfs.test \
ltlcrossce.test \
ltlcrossce2.test \
emptchkr.test \
ltlcounter.test \
basimul.test \
satmin.test \
satmin2.test \
spotlbtt.test \
ltlcross.test \
spotlbtt2.test \
ltlcross2.test \
complementation.test \
randpsl.test \
cycles.test
EXTRA_DIST = $(TESTS)
distclean-local:
rm -rf $(TESTS:.test=.dir)

144
src/tests/acc.cc Normal file
View file

@ -0,0 +1,144 @@
// -*- 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/>.
#include <iostream>
#include <iterator>
#include <vector>
#include <cassert>
#include <cstdlib>
#include "twa/acc.hh"
void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
{
std::cout << '#' << m.count() << ": " << ac.format(m);
if (!m)
std::cout << "empty";
if (ac.accepting(m))
std::cout << " accepting";
std::cout << '\n';
}
int main()
{
spot::acc_cond ac(4);
ac.set_generalized_buchi();
std::cout << ac.get_acceptance() << '\n';
auto m1 = ac.marks({0, 2});
auto m2 = ac.marks({0, 3});
auto m3 = ac.marks({2, 1});
check(ac, m1);
check(ac, m2);
check(ac, m3);
check(ac, m1 | m2);
check(ac, m2 & m1);
check(ac, m1 | m2 | m3);
ac.add_set();
ac.set_generalized_buchi();
check(ac, m1);
check(ac, m2);
check(ac, m3);
check(ac, m1 | m2);
check(ac, m2 & m1);
check(ac, m1 | m2 | m3);
check(ac, m2 & m3);
check(ac, ac.comp(m2 & m3));
spot::acc_cond ac2(ac.num_sets());
ac2.set_generalized_buchi();
check(ac2, m3);
spot::acc_cond ac3(ac.num_sets() + ac2.num_sets());
ac3.set_generalized_buchi();
std::cout << ac.num_sets() << " + "
<< ac2.num_sets() << " = " << ac3.num_sets() << '\n';
auto m5 = ac3.join(ac, m2, ac2, m3);
check(ac3, m5);
auto m6 = ac3.join(ac, ac.comp(m2 & m3), ac2, m3);
check(ac3, m6);
auto m7 = ac3.join(ac, ac.comp(m2 & m3), ac2, ac2.all_sets());
check(ac3, m7);
const char* comma = "";
for (auto i: m7.sets())
{
std::cout << comma << i;
comma = ",";
};
std::cout << '\n';
spot::acc_cond ac4;
ac4.set_generalized_buchi();
check(ac4, ac4.all_sets());
check(ac4, ac4.comp(ac4.all_sets()));
check(ac, (m1 | m2).remove_some(2));
std::vector<spot::acc_cond::mark_t> s = { m1, m2, m3 };
check(ac, ac.useless(s.begin(), s.end()));
s.push_back(ac.mark(4));
auto u = ac.useless(s.begin(), s.end());
check(ac, u);
std::cout << "stripping\n";
for (auto& v: s)
{
check(ac, v);
check(ac, v.strip(u));
}
auto code1 = ac.inf({0, 1, 3});
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code1.append_or(ac.fin({2}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code1.append_or(ac.fin({0}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code1.append_or(ac.fin({}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code1.append_and(ac.inf({}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
auto code2 = code1;
code1.append_and(ac.fin({0, 1}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code1.append_and(ac.fin({}));
std::cout << code1.size() << ' ' << code1 << ' ' << code1.is_dnf() << '\n';
code2.append_or(ac.fin({0, 1}));
std::cout << code2.size() << ' ' << code2 << ' ' << code2.is_dnf() << '\n';
auto code3 = ac.inf({0, 1});
code3.append_and(ac.fin({2, 3}));
std::cout << code3.size() << ' ' << code3 << ' ' << code3.is_dnf() << '\n';
std::cout << spot::parse_acc_code("t") << '\n';
std::cout << spot::parse_acc_code("f") << '\n';
std::cout << spot::parse_acc_code("Fin(2)") << '\n';
std::cout << spot::parse_acc_code("Inf(2)") << '\n';
std::cout << spot::parse_acc_code("Fin(2) | Inf(2)") << '\n';
std::cout << spot::parse_acc_code("Inf(2) & Fin(2)") << '\n';
auto c1 = spot::parse_acc_code("Fin(0)|Inf(1)&Fin(2)|Fin(3)");
auto c2 = spot::parse_acc_code
("( Fin ( 0 )) | (Inf ( 1) & Fin(2 ))| Fin (3) ");
std::cout << c1 << '\n';
std::cout << c2 << '\n';
assert(c1 == c2);
}

82
src/tests/acc.test Executable file
View file

@ -0,0 +1,82 @@
#!/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
cat >expect <<EOF
Inf(0)&Inf(1)&Inf(2)&Inf(3)
#2: {0,2}
#2: {0,3}
#2: {1,2}
#3: {0,2,3}
#1: {0}
#4: {0,1,2,3} accepting
#2: {0,2}
#2: {0,3}
#2: {1,2}
#3: {0,2,3}
#1: {0}
#4: {0,1,2,3}
#0: empty
#5: {0,1,2,3,4} accepting
#2: {1,2}
5 + 5 = 10
#4: {0,3,6,7}
#7: {0,1,2,3,4,6,7}
#10: {0,1,2,3,4,5,6,7,8,9} accepting
0,1,2,3,4,5,6,7,8,9
#0: empty accepting
#0: empty accepting
#1: {3}
#4: {0,1,2,3}
#2: {0,2}
stripping
#2: {0,2}
#0: empty
#2: {0,3}
#1: {1}
#2: {1,2}
#1: {0}
#1: {4}
#1: {2}
2 Inf(0)&Inf(1)&Inf(3) 1
5 Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
7 Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
10 (Fin(0)|Fin(1)) & (Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3))) 0
2 f 1
9 (Fin(0)|Fin(1)) | Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
5 (Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) 0
t
f
Fin(2)
Inf(2)
Inf(2) | Fin(2)
Fin(2) & Inf(2)
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
EOF
run 0 ../acc | tee stdout
diff stdout expect

115
src/tests/acc2.test Executable file
View file

@ -0,0 +1,115 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
../../bin/ltl2tgba -H 'GFa & GFb' > in
grep 'Acceptance:' in > expected
../../bin/ltl2tgba -H 'GFa & GFb' --stats='Acceptance: %a %g' > out1
../../bin/autfilt -H in --stats='Acceptance: %A %G' > out2
diff out1 expected
diff out2 expected
cat >header <<EOF
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
EOF
cat >body <<EOF
--BODY--
State: 0
[0&1] 0 {0 1}
[!0&!1] 0
[!0&1] 0 {1}
[0&!1] 0 {0}
--END--
EOF
#------------- DNF -------------
res="(Fin(1) & Fin(2) & Inf(0)) | (Inf(0)&Inf(1)&Inf(3))"
cat >acceptances<<EOF
2 Inf(0)&Inf(1), 2 Inf(0)&Inf(1)
2 Fin(0) & Inf(1), 2 Fin(0) & Inf(1)
2 t, 2 t
2 f, 2 f
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Inf(0)&Inf(1)) | (Fin(2) & Inf(0))
4 (Inf(1) | Fin(2)) & (Fin(1) | Inf(3)) & Inf(0), 4 $res
4 $res, 4 $res
3 (Fin(0)|Fin(1)) & Fin(2), 3 (Fin(0) & Fin(2)) | (Fin(1) & Fin(2))
EOF
while IFS=, read a b
do
(cat header; echo 'Acceptance:' $a; cat body) |
../../bin/autfilt -H --dnf-acc --stats '%A %G, %a %g'
done < acceptances > output
diff acceptances output
#------------- CNF -------------
res="(Fin(2) | Inf(1)) & (Fin(1) | Inf(3)) & Inf(0)"
cat >acceptances<<EOF
2 Inf(0)&Inf(1), 2 Inf(0)&Inf(1)
2 Fin(0) & Inf(1), 2 Fin(0) & Inf(1)
2 t, 2 t
2 f, 2 f
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Fin(2) | Inf(1)) & Inf(0)
4 (Fin(1) & Fin(2) & Inf(0)) | (Inf(0)&Inf(1)&Inf(3)), 4 $res
4 $res, 4 $res
3 (Fin(0) & Fin(2)) | (Fin(1) & Fin(2)), 3 (Fin(0)|Fin(1)) & Fin(2)
EOF
while IFS=, read a b
do
(cat header; echo 'Acceptance:' $a; cat body) |
../../bin/autfilt -H --cnf-acc --stats '%A %G, %a %g'
done < acceptances > output
diff acceptances output
#------------- COMP -------------
a="(Inf(1) | Fin(2)) & (Fin(1) | Inf(3)) & Inf(0)"
b="(Fin(1) & Inf(2)) | (Fin(3) & Inf(1)) | Fin(0)"
cat >acceptances<<EOF
2 Inf(0)&Inf(1), 2 Fin(0)|Fin(1)
2 Fin(0) & Inf(1), 2 Inf(0) | Fin(1)
2 t, 2 f
2 f, 2 t
3 (Inf(1) | Fin(2)) & Inf(0), 3 (Fin(1) & Inf(2)) | Fin(0)
4 $a, 4 $b
4 $b, 4 (Inf(1) | Fin(2)) & (Inf(3) | Fin(1)) & Inf(0)
3 (Fin(0)|Fin(1)) & Fin(2), 3 (Inf(0)&Inf(1)) | Inf(2)
EOF
while IFS=, read a b
do
(cat header; echo 'Acceptance:' $a; cat body) |
../../bin/autfilt -H --complement-acc --stats '%A %G, %a %g'
done < acceptances > output
diff acceptances output

48
src/tests/babiak.test Executable file
View file

@ -0,0 +1,48 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 2012, 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 <http://www.gnu.org/licenses/>.
# While running some benchmark, Tomáš Babiak found that Spot took too
# much time (i.e. >1h) to translate those six formulae. It turns out
# that the WDBA minimization was performed after the degeneralization
# algorithm, while this is not necessary (WDBA will produce a BA, so
# we may as well skip degeneralization). Translating these formulae
# in the test-suite ensure that they don't take too much time (the
# buildfarm will timeout if it does).
. ./defs
set -e
cat >formulae <<EOF
(p6 V X(G(F(F(X X(F X(F((G X F p1)|((F p5)U p1))))U((F p4)&(!p2|(G p0))))))))
(F((G 1)&(!p6 V X!p2)))V((F((G X(!p1 V!p3))V F!p2))U(X((G p3)U(p6 U p7))V X p5))
(((F p0)V((F p3)&!p4))V((((!p0|!p5)V X!p5)V p6)U(p5|(!p3 U(G(p1 U p2))))))
(G(((F((p3 &!p3)|(G((G!p2)V!p5))))|(p1 V!p4))U((X(G((F!p0)U!p6))U X!p2)|!p7)))
X((X(!p1 V F!p6)V F!p4)U p2)&(F(G((0 U(F p6))U((p1 U(G(p4 U F p0)))U X p7))))
(G(G(((F p5)U((((F!p1)V(p2 &!p4))|!p2)|((X!p7 U!p4)V(F(F((G p2)&p5))))))U p6)))
EOF
ltl2tgba=../ltl2tgba
../../bin/ltlcross <formulae \
"$ltl2tgba -t %f >%T" \
"$ltl2tgba -N -r4 -R3f %f >%N" \
"$ltl2tgba -N -r7 -R3 -x -Rm %f >%N" \
"$ltl2tgba -t -r7 -R3 -f -x -DS -Rm %f >%T"

74
src/tests/basimul.test Executable file
View file

@ -0,0 +1,74 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 2014 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
ltl2tgba=../../bin/ltl2tgba
# This bug was found while working on the state-based acceptance
# output for the LBTT format. Using ba-simul=2 causes reverse
# simulation to be applied to the BA automaton obtained after
# degeneralization. Unfortunately in Spot 1.1, reverse simulation is
# only implemented on TGBA, and when applied to a TGBA that is a BA,
# it may merge one state that is accepting with one state that is not
# accepting, just because they have the same incoming transitions.
# (Applying direct simulation on a TGBA that is a BA is not a problem,
# since an accepting state will never have the same outgoing
# transitions as a BA.)
# In previous tests, we did not notice the bug because the --lbtt
# output was always using transition-based acceptance (the equivalent
# of --lbtt=t today), so the result of the reverse-simulation on the
# BA was output as a TGBA with a single acceptance set, and some state
# had both accepting and non-accepting transitions because of the
# merge. Unfortunately, this is not a Büchi automaton. Using the
# --spin output, or the new (state-based) --lbtt output highlights the
# bug.
# In the cases below, the following configurations used to fail
# cross-comparison with the other "sane" configurations, at least
# with the first formula. (The other three formulas were added because
# they also triggered related issues while debugging the first one.)
# --lbtt -x ba-simul=2
# --lbtt -x ba-simul=3
# --spin -x ba-simul=2
# --spin -x ba-simul=3
../../bin/ltlcross --seed=0 --products=5 --json=out.json \
-f 'X((F(Xa | b) W c) U (Xc W (a & d)))' \
-f '((<> p5 V ((p0 U p1) <-> (p5 \/ p1))) -> ((<> p4 V p2) M p2))' \
-f '!p2 & (Fp5 R (((p0 U p1) & (p5 | p1)) | (!p5 & (!p0 R !p1))))' \
-f '! ((p0 /\ p4) <-> ! ((! p0 U (p0 W p4)) /\ (X p5 -> ([] p3 /\ p5))))' \
-f '(X <> (<> X p0 /\ X (p5 <-> p0)) W (p3 W p0))' \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=0 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=1 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=2 %f >%T" \
"$ltl2tgba --ba --high --lbtt=t -x ba-simul=3 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=0 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=1 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=2 %f >%T" \
"$ltl2tgba --ba --high --lbtt -x ba-simul=3 %f >%T" \
"$ltl2tgba --ba --high --spin -x ba-simul=0 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=1 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=2 %f >%N" \
"$ltl2tgba --ba --high --spin -x ba-simul=3 %f >%N"

136
src/tests/bitvect.cc Normal file
View file

@ -0,0 +1,136 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 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/>.
#include <iostream>
#include "misc/bitvect.hh"
void ruler()
{
std::cout << "\n ";
for (size_t x = 0; x < 76; ++x)
if (x % 10 == 0)
std::cout << x / 10;
else
std::cout << '_';
std::cout << "\n ";
for (size_t x = 0; x < 76; ++x)
std::cout << x % 10;
std::cout << "\n\n";
}
#define ECHO(name) std::cout << #name": " << *name << '\n'
int main()
{
ruler();
spot::bitvect* v = spot::make_bitvect(15);
ECHO(v);
v->set(10);
v->set(7);
v->set(12);
ECHO(v);
ruler();
spot::bitvect* w = spot::make_bitvect(42);
w->set(30);
w->set(41);
w->set(13);
w->set(7);
ECHO(w);
*w ^= *v;
ECHO(w);
ruler();
spot::bitvect* x = spot::make_bitvect(75);
x->set(70);
x->set(60);
ECHO(x);
*x |= *w;
ECHO(x);
std::cout << "subset? " << w->is_subset_of(*x)
<< ' ' << w->is_subset_of(*v) << '\n';
for (size_t i = 0; i < 30; ++i)
w->push_back((i & 3) == 0);
ECHO(w);
*x &= *w;
ECHO(x);
x->set_all();
ECHO(x);
ruler();
w->push_back(0x09, 4);
ECHO(w);
spot::bitvect* y = w->extract_range(0, 71);
ECHO(y);
delete y;
y = w->extract_range(0, 64);
ECHO(y);
delete y;
y = w->extract_range(64, 75);
ECHO(y);
delete y;
y = w->extract_range(0, 75);
ECHO(y);
delete y;
y = w->extract_range(7, 64);
ECHO(y);
delete y;
y = w->extract_range(7, 72);
ECHO(y);
delete y;
delete v;
delete w;
delete x;
ruler();
spot::bitvect_array* a = spot::make_bitvect_array(60, 10);
for (size_t y = 0; y < a->size(); ++y)
for (size_t x = 0; x < 60; ++x)
{
if (((x ^ y) & 3) < 2)
a->at(y).set(x);
}
std::cout << *a;
ruler();
for (size_t i = 0; i < 12; ++i)
a->at(4).push_back((i & 2) == 0);
a->at(6) = a->at(4);
a->at(8) = a->at(7);
a->at(6) ^= a->at(8);
std::cout << *a;
std::cout << "Comp: "
<< (a->at(0) == a->at(1))
<< (a->at(0) == a->at(2))
<< (a->at(1) != a->at(2))
<< (a->at(0) < a->at(2))
<< (a->at(0) > a->at(2))
<< (a->at(3) < a->at(4))
<< (a->at(5) > a->at(6)) << std::endl;
delete a;
}

92
src/tests/bitvect.test Executable file
View file

@ -0,0 +1,92 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 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
run 0 ../bitvect | tee stderr
cat >expected <<EOF
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
v: 000000000000000
v: 000000010010100
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
w: 000000010000010000000000000000100000000001
w: 000000000010110000000000000000100000000001
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
x: 000000000000000000000000000000000000000000000000000000000000100000000010000
x: 000000000010110000000000000000100000000001000000000000000000100000000010000
subset? 1 0
w: 000000000010110000000000000000100000000001100010001000100010001000100010
x: 000000000010110000000000000000100000000001000000000000000000000000000010000
x: 111111111111111111111111111111111111111111111111111111111111111111111111111
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
w: 0000000000101100000000000000001000000000011000100010001000100010001000101001
y: 00000000001011000000000000000010000000000110001000100010001000100010001
y: 0000000000101100000000000000001000000000011000100010001000100010
y: 00100010100
y: 000000000010110000000000000000100000000001100010001000100010001000100010100
y: 000101100000000000000001000000000011000100010001000100010
y: 00010110000000000000000100000000001100010001000100010001000100010
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
0: 110011001100110011001100110011001100110011001100110011001100
1: 110011001100110011001100110011001100110011001100110011001100
2: 001100110011001100110011001100110011001100110011001100110011
3: 001100110011001100110011001100110011001100110011001100110011
4: 110011001100110011001100110011001100110011001100110011001100
5: 110011001100110011001100110011001100110011001100110011001100
6: 001100110011001100110011001100110011001100110011001100110011
7: 001100110011001100110011001100110011001100110011001100110011
8: 110011001100110011001100110011001100110011001100110011001100
9: 110011001100110011001100110011001100110011001100110011001100
0_________1_________2_________3_________4_________5_________6_________7_____
0123456789012345678901234567890123456789012345678901234567890123456789012345
0: 110011001100110011001100110011001100110011001100110011001100
1: 110011001100110011001100110011001100110011001100110011001100
2: 001100110011001100110011001100110011001100110011001100110011
3: 001100110011001100110011001100110011001100110011001100110011
4: 110011001100110011001100110011001100110011001100110011001100110011001100
5: 110011001100110011001100110011001100110011001100110011001100
6: 111111111111111111111111111111111111111111111111111111111111110011001100
7: 001100110011001100110011001100110011001100110011001100110011
8: 001100110011001100110011001100110011001100110011001100110011
9: 110011001100110011001100110011001100110011001100110011001100
Comp: 1011010
EOF
diff expected stderr

120
src/tests/checkpsl.cc Normal file
View file

@ -0,0 +1,120 @@
// -*- 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/>.
#include <iostream>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include "ltlparse/public.hh"
#include "ltlast/allnodes.hh"
#include "twaalgos/ltl2tgba_fm.hh"
#include "twaalgos/ltl2taa.hh"
#include "twaalgos/sccfilter.hh"
#include "twaalgos/product.hh"
#include "twaalgos/dotty.hh"
void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
if (argc != 2)
syntax(argv[0]);
std::ifstream input(argv[1]);
if (!input)
{
std::cerr << "failed to open " << argv[1] << '\n';
return 2;
}
auto d = spot::make_bdd_dict();
std::string s;
unsigned line = 0;
while (std::getline(input, s))
{
++line;
std::cerr << line << ": " << s << '\n';
if (s.empty() || s[0] == '#') // Skip comments
continue;
spot::ltl::parse_error_list pe;
auto fpos = spot::ltl::parse(s, pe);
if (spot::ltl::format_parse_errors(std::cerr, s, pe))
return 2;
auto fneg =
spot::ltl::unop::instance(spot::ltl::unop::Not, fpos->clone());
{
auto apos = scc_filter(ltl_to_tgba_fm(fpos, d));
auto aneg = scc_filter(ltl_to_tgba_fm(fneg, d));
if (!spot::product(apos, aneg)->is_empty())
{
std::cerr << "non-empty intersection between pos and neg (FM)\n";
exit(2);
}
}
{
auto apos = scc_filter(ltl_to_tgba_fm(fpos, d, true));
auto aneg = scc_filter(ltl_to_tgba_fm(fneg, d, true));
if (!spot::product(apos, aneg)->is_empty())
{
std::cerr << "non-empty intersection between pos and neg (FM -x)\n";
exit(2);
}
}
if (fpos->is_ltl_formula())
{
auto apos =
scc_filter(make_twa_graph(ltl_to_taa(fpos, d),
spot::twa::prop_set::all()));
auto aneg =
scc_filter(make_twa_graph(ltl_to_taa(fneg, d),
spot::twa::prop_set::all()));
if (!spot::product(apos, aneg)->is_empty())
{
std::cerr << "non-empty intersection between pos and neg (TAA)\n";
exit(2);
}
}
fpos->destroy();
fneg->destroy();
}
spot::ltl::atomic_prop::dump_instances(std::cerr);
spot::ltl::unop::dump_instances(std::cerr);
spot::ltl::binop::dump_instances(std::cerr);
spot::ltl::multop::dump_instances(std::cerr);
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
return 0;
}

235
src/tests/checkta.cc Normal file
View file

@ -0,0 +1,235 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 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/>.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include "ltlparse/public.hh"
#include "ltlast/allnodes.hh"
#include "twaalgos/ltl2tgba_fm.hh"
#include "twaalgos/sccfilter.hh"
#include "twaalgos/degen.hh"
#include "twaalgos/stats.hh"
#include "taalgos/minimize.hh"
#include "taalgos/tgba2ta.hh"
#include "taalgos/dotty.hh"
#include "taalgos/stats.hh"
void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
exit(2);
}
void stats(std::string title, const spot::ta_ptr& ta)
{
auto s = stats_reachable(ta);
std::cout << std::left << std::setw(20) << title << " | "
<< std::right << std::setw(6) << s.states << " | "
<< std::setw(6) << s.transitions << " | "
<< std::setw(6) << s.acceptance_states << '\n';
}
void stats(std::string title, const spot::twa_ptr& tg)
{
auto s = stats_reachable(tg);
std::cout << std::left << std::setw(20) << title << " | "
<< std::right << std::setw(6) << s.states << " | "
<< std::setw(6) << s.transitions << " | "
<< std::setw(6) << "XXX" << '\n';
}
int
main(int argc, char** argv)
{
if (argc != 2)
syntax(argv[0]);
std::ifstream input(argv[1]);
if (!input)
{
std::cerr << "failed to open " << argv[1] << '\n';
return 2;
}
auto d = spot::make_bdd_dict();
std::string s;
while (std::getline(input, s))
{
std::cout << "in: " << s << '\n';
if (s.empty() || s[0] == '#') // Skip comments
continue;
spot::ltl::parse_error_list pe;
auto f = spot::ltl::parse(s, pe);
if (spot::ltl::format_parse_errors(std::cerr, s, pe))
return 2;
{
auto a = ltl_to_tgba_fm(f, d);
bdd ap_set = atomic_prop_collect_as_bdd(f, a);
// run 0 ../ltl2tgba -TGTA -ks "$1"
// run 0 ../ltl2tgba -TGTA -RT -ks "$1"
{
auto t = spot::tgba_to_tgta(a, ap_set);
stats("-TGTA", t);
stats("-TGTA -RT", minimize_tgta(t));
}
{
// run 0 ../ltl2tgba -TA -ks "$1"
// run 0 ../ltl2tgba -TA -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
false, // degen (-DS)
false, // artificial_initial_state (-in)
false, // single_pass (-sp),
false); // artificial_livelock (-lv)
stats("-TA", t);
stats("-TA -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -lv -ks "$1"
// run 0 ../ltl2tgba -TA -lv -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
false, // degen (-DS)
false, // artificial_initial_state (-in)
false, // single_pass (-sp),
true); // artificial_livelock (-lv)
stats("-TA -lv", t);
stats("-TA -lv -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -sp -ks "$1"
// run 0 ../ltl2tgba -TA -sp -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
false, // degen (-DS)
false, // artificial_initial_state (-in)
true, // single_pass (-sp),
false); // artificial_livelock (-lv)
stats("-TA -sp", t);
stats("-TA -sp -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -lv -sp -ks "$1"
// run 0 ../ltl2tgba -TA -lv -sp -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
false, // degen (-DS)
false, // artificial_initial_state (-in)
true, // single_pass (-sp),
true); // artificial_livelock (-lv)
stats("-TA -lv -sp", t);
stats("-TA -lv -sp -RT", minimize_ta(t));
}
a = spot::degeneralize(a);
{
// run 0 ../ltl2tgba -TA -DS -ks "$1"
// run 0 ../ltl2tgba -TA -DS -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
true, // degen (-DS)
false, // artificial_initial_state (-in)
false, // single_pass (-sp),
false); // artificial_livelock (-lv)
stats("-TA -DS", t);
stats("-TA -DS -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -DS -lv -ks "$1"
// run 0 ../ltl2tgba -TA -DS -lv -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
true, // degen (-DS)
false, // artificial_initial_state (-in)
false, // single_pass (-sp),
true); // artificial_livelock (-lv)
stats("-TA -DS -lv", t);
stats("-TA -DS -lv -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -DS -sp -ks "$1"
// run 0 ../ltl2tgba -TA -DS -sp -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
true, // degen (-DS)
false, // artificial_initial_state (-in)
true, // single_pass (-sp),
false); // artificial_livelock (-lv)
stats("-TA -DS -sp", t);
stats("-TA -DS -sp -RT", minimize_ta(t));
}
{
// run 0 ../ltl2tgba -TA -DS -lv -sp -ks "$1"
// run 0 ../ltl2tgba -TA -DS -lv -sp -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
true, // degen (-DS)
false, // artificial_initial_state (-in)
true, // single_pass (-sp),
true); // artificial_livelock (-lv)
stats("-TA -DS -lv -sp", t);
stats("-TA -DS -lv -sp -RT", minimize_ta(t));
}
}
// Some cases with -x -R3 -DS -in
{
auto a = spot::degeneralize(scc_filter(ltl_to_tgba_fm(f, d, true)));
bdd ap_set = atomic_prop_collect_as_bdd(f, a);
{
// run 0 ../ltl2tgba -x -R3 -DS -TA -in -ks "$1"
// run 0 ../ltl2tgba -x -R3 -DS -TA -in -RT -ks "$1"
auto t = spot::tgba_to_ta(a, ap_set,
true, // degen (-DS)
false, // artificial_initial_state (-in)
false, // single_pass (-sp),
true); // artificial_livelock (-lv)
stats("-x -TA -DS -in", t);
stats("-x -TA -DS -in -RT", minimize_ta(t));
}
}
f->destroy();
}
spot::ltl::atomic_prop::dump_instances(std::cerr);
spot::ltl::unop::dump_instances(std::cerr);
spot::ltl::binop::dump_instances(std::cerr);
spot::ltl::multop::dump_instances(std::cerr);
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
return 0;
}

View file

@ -0,0 +1,269 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 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/>.
#include <iomanip>
#include <iostream>
#include "twaalgos/dotty.hh"
#include "twaalgos/hoa.hh"
#include "hoaparse/public.hh"
#include "twa/twaproduct.hh"
#include "twaalgos/gtec/gtec.hh"
#include "twaalgos/ltl2tgba_fm.hh"
#include "ltlparse/public.hh"
#include "twaalgos/stats.hh"
#include "twaalgos/emptiness.hh"
#include "ltlast/unop.hh"
#include "twaalgos/stats.hh"
#include "twaalgos/emptiness_stats.hh"
#include "twaalgos/degen.hh"
#include "twa/twasafracomplement.hh"
void usage(const char* prog)
{
std::cout << "usage: " << prog << " [options]" << std::endl;
std::cout << "with options" << std::endl
<< "-H Output in HOA\n"
<< "-s buchi_automaton display the safra automaton\n"
<< "-a buchi_automaton display the complemented automaton\n"
<< "-astat buchi_automaton statistics for !a\n"
<< "-fstat formula statistics for !A_f\n"
<< "-f formula test !A_f and !A_!f\n"
<< "-p formula print the automaton for f\n";
}
int main(int argc, char* argv[])
{
char *file = 0;
bool print_safra = false;
bool print_automaton = false;
//bool check = false;
int return_value = 0;
bool stats = false;
bool formula = false;
bool print_formula = false;
bool save_hoa = false;
if (argc < 3)
{
usage(argv[0]);
return 1;
}
for (int i = 1; i < argc; ++i)
{
if (argv[i][0] == '-')
{
if (strcmp(argv[i] + 1, "H") == 0)
{
save_hoa = true;
continue;
}
if (strcmp(argv[i] + 1, "astat") == 0)
{
stats = true;
formula = false;
continue;
}
if (strcmp(argv[i] + 1, "fstat") == 0)
{
stats = true;
formula = true;
continue;
}
switch (argv[i][1])
{
case 's':
print_safra = true; break;
case 'a':
print_automaton = true; break;
case 'f':
//check = true;
break;
case 'p':
print_formula = true; break;
default:
std::cerr << "unrecognized option `-" << argv[i][1]
<< '\'' << std::endl;
return 2;
}
}
else
file = argv[i];
}
if (file == 0)
{
usage(argv[0]);
return 1;
}
auto dict = spot::make_bdd_dict();
if (print_automaton || print_safra)
{
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::hoa_parse_error_list pel;
auto h = spot::hoa_parse(file, pel, dict, env);
if (spot::format_hoa_parse_errors(std::cerr, file, pel))
return 2;
spot::twa_graph_ptr a = h->aut;
spot::twa_ptr complement = 0;
complement = spot::make_safra_complement(a);
if (print_automaton)
{
if (save_hoa)
spot::hoa_reachable(std::cout, complement, nullptr);
else
spot::dotty_reachable(std::cout, complement);
}
if (print_safra)
{
auto safra_complement =
std::dynamic_pointer_cast<spot::tgba_safra_complement>(complement);
spot::display_safra(safra_complement);
}
}
else if (print_formula)
{
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
auto a = spot::ltl_to_tgba_fm(f1, dict);
spot::twa_ptr complement = 0;
complement = spot::make_safra_complement(a);
spot::dotty_reachable(std::cout, complement);
f1->destroy();
}
else if (stats)
{
spot::twa_graph_ptr a;
const spot::ltl::formula* f1 = 0;
if (formula)
{
spot::ltl::parse_error_list p1;
f1 = spot::ltl::parse(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
a = spot::ltl_to_tgba_fm(f1, dict);
}
else
{
spot::hoa_parse_error_list pel;
spot::ltl::environment& env(spot::ltl::default_environment::instance());
auto h = spot::hoa_parse(file, pel, dict, env);
if (spot::format_hoa_parse_errors(std::cerr, file, pel))
return 2;
a = h->aut;
}
auto safra_complement = spot::make_safra_complement(a);
spot::tgba_statistics a_size = spot::stats_reachable(a);
std::cout << "Original: "
<< a_size.states << ", "
<< a_size.transitions << ", "
<< a->acc().num_sets()
<< std::endl;
auto buchi = spot::degeneralize(a);
std::cout << "Buchi: "
<< buchi->num_states()
<< buchi->num_transitions()
<< buchi->acc().num_sets()
<< std::endl;
spot::tgba_statistics b_size = spot::stats_reachable(safra_complement);
std::cout << "Safra Complement: "
<< b_size.states << ", "
<< b_size.transitions << ", "
<< safra_complement->acc().num_sets()
<< std::endl;
if (formula)
{
auto nf1 = spot::ltl::unop::instance(spot::ltl::unop::Not, f1->clone());
auto a2 = spot::ltl_to_tgba_fm(nf1, dict);
spot::tgba_statistics a_size = spot::stats_reachable(a2);
std::cout << "Not Formula: "
<< a_size.states << ", "
<< a_size.transitions << ", "
<< a2->acc().num_sets()
<< std::endl;
f1->destroy();
nf1->destroy();
}
}
else
{
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
auto Af = spot::ltl_to_tgba_fm(f1, dict);
auto nf1 = spot::ltl::unop::instance(spot::ltl::unop::Not, f1->clone());
auto Anf = spot::ltl_to_tgba_fm(nf1, dict);
auto nAf = spot::make_safra_complement(Af);
auto nAnf = spot::make_safra_complement(Anf);
auto ec = spot::couvreur99(spot::otf_product(nAf, nAnf));
auto res = ec->check();
spot::tgba_statistics a_size = spot::stats_reachable(ec->automaton());
std::cout << "States: "
<< a_size.states << std::endl
<< "Transitions: "
<< a_size.transitions << std::endl
<< "Acc Cond: "
<< ec->automaton()->acc().num_sets()
<< std::endl;
if (res)
{
std::cout << "FAIL\n";
return_value = 1;
if (auto run = res->accepting_run())
{
spot::dotty_reachable(std::cout, ec->automaton());
spot::print_tgba_run(std::cout, ec->automaton(), run);
}
}
else
{
std::cout << "OK\n";
}
nf1->destroy();
f1->destroy();
}
return return_value;
}

69
src/tests/complementation.test Executable file
View file

@ -0,0 +1,69 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2011, 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
while read f; do
run 0 ../complement -f "$f"
done <<EOF
GFa
FGa
<>p1->p0
<>p1->(p0 U p1)
[](p0-><>p3)
a U b
GFa&&FGa
[] ((p2 && ! p1) -> (p0 U (p1 || [] p0)))
[] (p2 -> ((! p0 && ! p1) U (p1 || ((p0 && ! p1) U (p1 || ((! p0 && ! p1) \
U (p1 || ((p0 && ! p1) U ((p1 || (! p0 U (p1 || [] ! p0))) || [] p0)))))))))
EOF
# The following test-case was supplied by Martin Dieguez Lodeiro to
# demonstrate a bug in our Safra implementation.
cat >x.hoa <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "p"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
--BODY--
State: 0
[t] 0
[0] 1
State: 1
[t] 1
[0] 2 {0}
State: 2
[t] 1
[0] 2 {0}
--END--
EOF
# x.tgba accepts some run
run 0 ../ltl2tgba -XH -e x.hoa
# so does its complement
run 0 ../complement -H -a x.hoa > nx.hoa
run 0 ../ltl2tgba -XH -e nx.hoa
# however the intersection of both should not
# accept any run.
run 1 ../../bin/autfilt -q nx.hoa --intersect x.hoa

117
src/tests/complete.test Executable file
View file

@ -0,0 +1,117 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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 || exit 1
set -e
cat >automaton <<EOF
HOA: v1
States: 2
Start: 0
AP: 1 "a"
Acceptance: 1 Fin(0)
--BODY--
State: 0
[0] 1
State: 1
[0] 1
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "a"
Acceptance: 2 t
--BODY--
State: 0
[0] 1
State: 1
[0] 1
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "a"
Acceptance: 0 f
--BODY--
State: 0
[0] 1
State: 1
[0] 1
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "a"
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[0] 1
[!0] 2
State: 1
[0] 1
[!0] 2
State: 2 {0}
[t] 2
--END--
HOA: v1
States: 3
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0 {0}
[0] 1
[!0] 2
State: 1 {0}
[0] 1
[!0] 2
State: 2
[t] 2
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "a"
Acceptance: 0 f
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[0] 1
[!0] 1
State: 1
[0] 1
[!0] 1
--END--
EOF
run 0 ../../bin/autfilt -CH automaton >out
cat out
diff out expected

74
src/tests/cycles.test Executable file
View file

@ -0,0 +1,74 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 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
# Fig.1 from Johnson's SIAM J. Comput. 1975 paper.
cat >johnson-fig1.hoa <<EOF
HOA: v1
States: 12
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0
[t] 1
[t] 3
[t] 4
State: 1
[t] 2
State: 2
[t] 5
[t] 6
State: 3
[t] 2
State: 4
[t] 2
State: 5
[t] 6
[t] 7
State: 6
[t] 8
[t] 10
[t] 11
State: 7
[t] 0
[t] 6
State: 8
[t] 2
[t] 9
State: 9
[t] 6
State: 10
[t] 9
State: 11
[t] 9
--END--
EOF
run 0 ../ltl2tgba -KC -XH johnson-fig1.hoa > out
test `wc -l < out` -eq 10
run 0 ../ltl2tgba -KW '(Ga -> Gb) W c' > out
test `grep 'is weak' out | wc -l` -eq 4
test `grep 'is not weak' out | wc -l` -eq 1

59
src/tests/dbacomp.test Executable file
View file

@ -0,0 +1,59 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 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
# This automaton used to trigger a bug in the complementation: its
# intersection with the complement was not empty!
cat >input.hoa <<EOF
HOA: v1
States: 3
Start: 0
AP: 4 "a" "d" "b" "c"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels trans-acc deterministic
--BODY--
State: 0
[0&1 | 0&2] 0 {1 2}
[!0&1 | !0&2] 0 {0 1 2}
[0&!1&!2&!3] 1
[!0&!1&!2&!3] 1 {0}
State: 1
[0&2&3] 0 {1 2}
[!0&2&3] 0 {0 1 2}
[0&!2&!3] 1
[!0&!2&!3] 1 {0}
[0&2&!3] 2 {1}
[!0&2&!3] 2 {0 1}
State: 2
[0&1&3 | 0&2&3] 0 {1 2}
[!0&1&3 | !0&2&3] 0 {0 1 2}
[0&!1&!2&!3] 1
[!0&!1&!2&!3] 1 {0}
[0&1&!3 | 0&2&!3] 2 {1}
[!0&1&!3 | !0&2&!3] 2 {0 1}
--END--
EOF
# Check emptiness of product with complement.
run 0 ../ltl2tgba -H -DC -C -XH input.hoa > output.hoa
run 1 ../../bin/autfilt -q input.hoa --intersect output.hoa

99
src/tests/defs.in Normal file
View file

@ -0,0 +1,99 @@
# -*- mode: shell-script; coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012, 2013, 2015 Laboratoire de Recherche
# et Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2006 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 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/>.
# Ensure we are running from the right directory.
test -f ./defs || {
echo "defs: not found in current directory" 1>&2
exit 1
}
# If srcdir is not set, then we are not running from `make check'.
if test -z "$srcdir"; then
# compute $srcdir.
srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
test $srcdir = $0 && srcdir=.
fi
# Ensure $srcdir is set correctly.
test -f $srcdir/defs.in || {
echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
exit 1
}
echo "== Running test $0"
me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
testSubDir=$me.dir
chmod -R a+rwx $testSubDir > /dev/null 2>&1
rm -rf $testSubDir > /dev/null 2>&1
mkdir $testSubDir
cd $testSubDir
# Adjust srcdir now that we are in a subdirectory. We still want
# $srcdir to point to the source directory corresponding to the build
# directory that contains $testSubDir.
case $srcdir in
[\\/$]* | ?:[\\/]* );;
*) srcdir=../$srcdir
esac
DOT='@DOT@'
top_builddir='../@top_builddir@'
LBTT="@LBTT@"
LBTT_TRANSLATE="@LBTT_TRANSLATE@"
VALGRIND='@VALGRIND@'
SPIN='@SPIN@'
LTL2BA='@LTL2BA@'
PYTHON='@PYTHON@'
# The test cases assume these variable are undefined
unset SPOT_DOTEXTRA
unset SPOT_DOTDEFAULT
need_lbtt()
{
# LBTT may not have been installed or compiled.
("$LBTT" --version) || exit 77
}
run()
{
expected_exitcode=$1
shift
exitcode=0
if test -n "$VALGRIND"; then
exec 6>valgrind.err
GLIBCPP_FORCE_NEW=1 \
../../../libtool --mode=execute \
$VALGRIND --tool=memcheck --leak-check=yes --log-fd=6 -q "$@" ||
exitcode=$?
cat valgrind.err 1>&2
test -z "`sed 1q valgrind.err`" || exit 50
rm -f valgrind.err
else
"$@" || exitcode=$?
fi
test $exitcode = $expected_exitcode || exit 1
}
set -x

38
src/tests/degendet.test Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 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
# The following command, reported by Tomáš Babiak, used to output many
# different automata, because state addresses were used to order the
# successors in the degeneralization.
# Make sure all these runs output the same automaton.
# With valgrind
run 0 ../ltl2tgba -r7 -x -R3 -N "XF(Gp2 | F(p0 U (p1 & (! p4 | p3))))" > out1
# Without valgrind
for i in 2 3 4 5; do
../ltl2tgba -r7 -x -R3 -N "XF(Gp2 | F(p0 U (p1 & (! p4 | p3))))" > out
cmp out out1 || exit 1
done

256
src/tests/degenid.test Executable file
View file

@ -0,0 +1,256 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 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
# Make sure degeneralization is idempotent
for f in 'FGa|GFb' 'GFa & GFb & GFc' 'GF(a->FGb)&GF(c->FGd)'; do
for opt in -DS -DT; do
../ltl2tgba $opt -H "$f" > autX.spot
../ltl2tgba -XH -kt autX.spot > base.size
cat base.size
for x in X XX XXX; do
../ltl2tgba -XH $opt -H aut$x.spot > autX$x.spot
../ltl2tgba -XH -kt autX$x.spot > new.size
cat new.size
cmp base.size new.size
done
done
done
# This is another 6-state degeneralized automaton that
# we used the "redegeneralize" to a 8-state BA...
cat > bug <<EOF
HOA: v1
States: 6
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0 {0}
[!0 | !1] 1
[0&1] 2
State: 1 {0}
[!0&1] 1
[!0&!1] 3
[0] 4
State: 2
[0&!1] 0
[!0&!1] 1
[0&1] 2
[!0&1] 5
State: 3
[0&1] 0
[!0&1] 1
[!0&!1] 3
[0&!1] 4
State: 4
[1] 0
[0&!1] 2
[!0&!1] 5
State: 5
[!1] 0
[!0&1] 3
[0&1] 4
--END--
EOF
run 0 ../ltl2tgba -ks -XH -DS bug > out
grep 'states: 6' out
# This 8-state degeneralized automaton used
# to be "degeneralized" to a 9-state BA...
cat > bug2 <<EOF
HOA: v1
States: 8
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0
[t] 1
State: 1 {0}
[t] 2
State: 2
[0&!1] 2
[0&1] 3
[!0&!1] 4
[!0&1] 5
State: 3 {0}
[0] 2
[!0] 4
State: 4
[0&!1] 2
[0&1] 3
[!0&1] 5
[!0&!1] 6
State: 5 {0}
[0&!1] 2
[0&1] 3
[!0&1] 5
[!0&!1] 6
State: 6
[0&!1] 2
[0&1] 3
[!0&!1] 6
[!0&1] 7
State: 7
[0] 3
[!0] 7
--END--
EOF
run 0 ../ltl2tgba -ks -XH -DS bug2 >out
grep 'states: 8' out
# This automaton should have a 3-state BA, but it's really
# easy to obtain a 4-state BA when tweaking the degeneralization
# to ignore arc entering an SCC.
test 3 = "`../../bin/ltl2tgba -B 'G(a|G(b|Fc))' --stats=%s`"
# This 7-state DRA (built with
# ltlfilt -f 'F(a & GFb) | (Fc & Fa & F(c & GF!b))' -l |
# ltl2dstar --ltl2nba=spin:ltl2tgba@-sD - -
# should be converted in into a 6-state DBA.
cat >in.dra <<EOF
DRA v2 explicit
Comment: "Union{Safra[NBA=3],Safra[NBA=5]}"
States: 7
Acceptance-Pairs: 2
Start: 5
AP: 3 "a" "b" "c"
---
State: 0
Acc-Sig: +0 +1
1
1
2
2
1
1
2
2
State: 1
Acc-Sig: +1
1
1
2
2
1
1
2
2
State: 2
Acc-Sig: +0
1
1
2
2
1
1
2
2
State: 3
Acc-Sig: +0
6
6
3
3
1
1
0
0
State: 4
Acc-Sig:
4
0
4
0
4
0
4
0
State: 5
Acc-Sig:
5
3
5
3
4
0
4
0
State: 6
Acc-Sig:
6
6
3
3
1
1
0
0
EOF
run 0 ../../bin/dstar2tgba in.dra -BD --stats=%s > out.stat
test 6 = "`cat out.stat`"
# Only one state should be accepting. In spot 1.2.x an initial state
# in a trivial SCC was marked as accepting: this is superfluous.
../../bin/ltl2tgba -BH 'a & GFb & GFc' > out
cat out
cat >expected<<EOF
HOA: v1
name: "a & G(Fb & Fc)"
States: 4
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
properties: stutter-invariant
--BODY--
State: 0
[0] 1
State: 1 {0}
[1&2] 1
[!1&2] 2
[!2] 3
State: 2
[1] 1
[!1] 2
State: 3
[1&2] 1
[!1&2] 2
[!2] 3
--END--
EOF
diff out expected

134
src/tests/degenlskip.test Executable file
View file

@ -0,0 +1,134 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
# Make sure degen-skip=0 and degen-skip=1 produce the expected
# automata for 'GFa & GFb'
../../bin/ltl2tgba -B 'GFa & GFb' --hoa > out1
../../bin/ltl2tgba -B -x degen-lskip=1 'GFa & GFb' --hoa > out2
../../bin/ltl2tgba -B -x degen-lskip=0 'GFa & GFb' --hoa > out3
../../bin/ltl2tgba -B -x degen-lskip=1,degen-lowinit=1 'GFa & GFb' --hoa > out4
../../bin/ltl2tgba -B -x degen-lskip=0,degen-lowinit=1 'GFa & GFb' --hoa > out5
diff out1 out2
cmp out2 out3 && exit 1
cat <<EOF >expected2
HOA: v1
name: "G(Fa & Fb)"
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0 {0}
[0&1] 0
[!1] 1
[!0&1] 2
State: 1
[0&1] 0
[!1] 1
[!0&1] 2
State: 2
[0] 0
[!0] 2
--END--
EOF
cat <<EOF >expected3
HOA: v1
name: "G(Fa & Fb)"
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0 {0}
[t] 1
State: 1
[!1] 1
[1] 2
State: 2
[0] 0
[!0] 2
--END--
EOF
cat <<EOF >expected4
HOA: v1
name: "G(Fa & Fb)"
States: 3
Start: 1
AP: 2 "a" "b"
Acceptance: 1 Inf(0)
--BODY--
State: 0 {0}
[0&1] 0
[!1] 1
[!0&1] 2
State: 1
[0&1] 0
[!1] 1
[!0&1] 2
State: 2
[0] 0
[!0] 2
--END--
EOF
cat <<EOF >expected5
HOA: v1
name: "G(Fa & Fb)"
States: 3
Start: 2
AP: 2 "a" "b"
Acceptance: 1 Inf(0)
--BODY--
State: 0 {0}
[t] 2
State: 1
[0] 0
[!0] 1
State: 2
[1] 1
[!1] 2
--END--
EOF
run 0 ../../bin/autfilt -q -F out2 --isomorph expected2
run 0 ../../bin/autfilt -q -F out3 --isomorph expected3
cat out4 out5
../../bin/autfilt -q out4 --isomorph expected2 && exit 1
../../bin/autfilt -q out5 --isomorph expected3 && exit 1
../../bin/autfilt -q out4 --isomorph expected4
../../bin/autfilt -q out5 --isomorph expected5

160
src/tests/det.test Executable file
View file

@ -0,0 +1,160 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
ltl2tgba=../../bin/ltl2tgba
cat >formulas <<'EOF'
1,13,X((a M F((!b & !c) | (b & c))) W (G!c U b))
1,5,X(((a & b) R (!a U !c)) R b)
1,9,XXG(Fa U Xb)
1,5,(!a M !b) W F!c
1,3,(b & Fa & GFc) R a
1,2,(a R (b W a)) W G(!a M (b | c))
1,11,(Fa W b) R (!a | Fc)
1,7,X(G(!a M !b) | G(a | G!a))
1,2,Fa W Gb
1,3,Ga | GFb
1,9,G((G!a & ((!b & X!c) | (b & Xc))) | (Fa & ((!b & Xc) | (b & X!c))))
1,5,a M G(F!b | X!a)
1,4,G!a R XFb
1,4,XF(!a | GFb)
1,6,G(F!a U !a) U Xa
1,5,(a | G(a M !b)) W Fc
1,6,Fa W Xb
1,10,X(a R ((!b & F!c) M X!a))
1,2,XG!a R Fb
1,4,GFc | (a & Fb)
1,6,X(a R (Fb R F!b))
1,2,G(Xa M Fa)
1,4,X(Gb | GFa)
1,9,X(Gc | XG((b & Ga) | (!b & F!a)))
1,2,Ga R Fb
1,3,G(a U (b | X((!a & !c) | (a & c))))
1,5,XG((G!a & F!b) | (Fa & (a | Gb)))
1,10,(a U X!a) | XG(!b & XFc)
1,4,X(G!a | GFa)
1,4,G(G!a | F!c | G!b)
EOF
$ltl2tgba -x tba-det --det --stats '%d,%s,%f' -F formulas/3 > out
diff formulas out
cat >in.hoa <<'EOF'
HOA: v1
States: 3
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[!0] 0
[0] 1 {0}
State: 1
[!0] 0
[0] 2 {0}
State: 2
[!0] 0
[0] 2
--END--
EOF
cat >ex.hoa <<'EOF'
HOA: v1
States: 5
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc inherently-weak
--BODY--
State: 0
[!0] 0
[0] 1
[!0] 3
State: 1
[!0] 0
[0] 2
[!0] 3
State: 2
[!0] 0
[0] 2
[!0] 3
[0] 4
State: 3 {0}
[!0] 3
State: 4 {0}
[!0] 3
[0] 4
--END--
EOF
run 0 ../ltl2tgba -H -DC -XH in.hoa > out.hoa
run 1 ../../bin/autfilt -q --are-isomorph in.hoa out.hoa
run 0 ../../bin/autfilt -q --are-isomorph ex.hoa out.hoa
run 0 ../ltl2tgba -x -DC 'GFa & XGFb' > out.tgba
cat >ex.tgba <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 1 [label="1"]
1 [label="1"]
1 -> 1 [label="1"]
1 -> 2 [label="!a"]
1 -> 3 [label="!b"]
2 [label="2", peripheries=2]
2 -> 2 [label="!a"]
3 [label="3", peripheries=2]
3 -> 3 [label="!b"]
}
EOF
diff out.tgba ex.tgba
# This formula produce a co-deterministic automaton that is not deterministic,
# and a bug in the cosimulation caused the result to be marked as deterministic.
run 0 ../../bin/ltl2tgba -H '(0 R Xa) R (a xor Fa)' > out.hoa
grep deterministic out.hoa && exit 1
# These highlighted a bug in the bitvector routines because their
# state count is a multiple of 64.
cat >input <<EOF
G(!a | Xa),2
G(!a | XXa),4
G(!a | XXXa),8
G(!a | XXXXa),16
G(!a | XXXXXa),32
G(!a | XXXXXXa),64
G(!a | XXXXXXXa),128
G(!a | XXXXXXXXa),256
EOF
run 0 ../../bin/ltl2tgba -D -F input/1 --stats='%f,%s' > output
cat output
diff input output
true

243
src/tests/dfs.test Executable file
View file

@ -0,0 +1,243 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 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 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
# All examples are TBA (i.e. they have a unique
# acceptance condition). Accepting arcs are
# represented by double arrows.
#
# s1=>s2->s3->(large composant from s4 to s9)
# ^ |
# |_______|
cat >blue_counter <<'EOF'
HOA: v1
States: 9
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0 {0}
[t] 1
State: 1
[t] 2
State: 2
[t] 0
[t] 3
State: 3
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 4
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 5
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 6
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 7
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 8
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
--END--
EOF
run 0 ../ltl2tgba -CR -eSE05 -XH blue_counter
run 0 ../ltl2tgba -CR -eTau03_opt -XH blue_counter
# s1->s2->s3->(large composant from s4 to s9)
# ^ ||
# ||______||
# ||______||
cat >blue_last <<'EOF'
HOA: v1
States: 9
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
--BODY--
State: 0
[t] 1
State: 1
[t] 2
State: 2
[t] 0 {0}
[t] 3
State: 3
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 4
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 5
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 6
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 7
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 8
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
--END--
EOF
run 0 ../ltl2tgba -CR -eSE05 -XH blue_last
run 0 ../ltl2tgba -CR -eTau03_opt -XH blue_last
# _______
# | |
# | v
# s1->s2->s3->(large composant from s4 to s9)
# || ^
# ||______||
# ||______||
cat >red <<'EOF'
HOA: v1
States: 9
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
--BODY--
State: 0
[t] 1
[t] 2 {0}
State: 1
[t] 2
State: 2
[t] 0
[t] 3
State: 3
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 4
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 5
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 6
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 7
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
State: 8
[t] 3
[t] 4
[t] 5
[t] 6
[t] 7
[t] 8
--END--
EOF
run 0 ../ltl2tgba -CR -eSE05 -XH red
run 0 ../ltl2tgba -CR -eTau03_opt -XH red
rm -f red blue_counter blue_last

333
src/tests/dra2dba.test Executable file
View file

@ -0,0 +1,333 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2014 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
# This failure to produce a deterministic automaton was noticed by
# Alexandre Lewkowicz.
# The following is the output of
# ltlfilt -f 'G(F!a | (Fb U c))' -l |
# ltl2dstar --ltl2nba=spin:$HOME/usr/bin/ltl2tgba@-s - -
cat > in.dra <<EOF
DRA v2 explicit
Comment: "Safra[NBA=8]"
States: 29
Acceptance-Pairs: 3
Start: 7
AP: 3 "a" "b" "c"
---
State: 0
Acc-Sig: -2
21
0
20
1
15
4
13
22
State: 1
Acc-Sig: -2
21
0
20
1
13
22
13
22
State: 2
Acc-Sig: -2
15
3
13
12
15
2
13
14
State: 3
Acc-Sig: -2
16
3
20
12
15
2
13
14
State: 4
Acc-Sig: -2
15
3
13
12
15
4
13
22
State: 5
Acc-Sig: -2
15
17
13
12
15
5
13
14
State: 6
Acc-Sig: -2
28
6
20
18
15
5
13
14
State: 7
Acc-Sig: -1 -2
13
19
13
18
13
13
13
13
State: 8
Acc-Sig: -1 -2
23
9
13
1
23
8
13
22
State: 9
Acc-Sig: -1 -2
24
9
20
1
23
8
13
22
State: 10
Acc-Sig: -1 -2
26
11
25
10
13
22
13
22
State: 11
Acc-Sig: -1 -2
26
11
25
10
23
8
13
22
State: 12
Acc-Sig: +0 -1 -2
21
0
20
1
13
22
13
22
State: 13
Acc-Sig: +0 -1 -2
13
11
13
10
13
13
13
13
State: 14
Acc-Sig: +0 -1 -2
13
19
13
18
13
22
13
22
State: 15
Acc-Sig: +0 -1 -2
23
6
13
18
23
23
13
13
State: 16
Acc-Sig: +0 -1 -2
24
6
20
18
23
23
13
13
State: 17
Acc-Sig: +0 -1 -2
24
9
20
1
23
8
13
22
State: 18
Acc-Sig: +0 -1 -2
26
11
25
10
13
22
13
22
State: 19
Acc-Sig: +0 -1 -2
26
11
25
10
23
8
13
22
State: 20
Acc-Sig: +0 -1 -2
26
19
25
18
13
13
13
13
State: 21
Acc-Sig: +0 -1 -2
26
19
25
18
23
23
13
13
State: 22
Acc-Sig: +1 -2
13
19
13
18
13
22
13
22
State: 23
Acc-Sig: +1 -2
23
6
13
18
23
23
13
13
State: 24
Acc-Sig: +1 -2
24
6
20
18
23
23
13
13
State: 25
Acc-Sig: +1 -2
26
19
25
18
13
13
13
13
State: 26
Acc-Sig: +1 -2
26
19
25
18
23
23
13
13
State: 27
Acc-Sig: +1 -2
28
6
20
18
15
5
13
14
State: 28
Acc-Sig: +2
28
27
20
18
15
15
13
13
EOF
test `../../bin/dstar2tgba -D in.dra --stats="%d:%s:%e"` = "1:23:143"

274
src/tests/dstar.test Executable file
View file

@ -0,0 +1,274 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
# DRA generated with
# ltlfilt -f 'a U b' -l | ltl2dstar --ltl2nba=spin:path/ltl2tgba@-s - -
cat >dra.dstar <<EOF
DRA v2 explicit
Comment: "Safra[NBA=2]"
States: 3
Acceptance-Pairs: 1
Start: 0
AP: 2 "a" "b"
---
State: 0
Acc-Sig:
1
0
2
2
State: 1
Acc-Sig: -0
1
1
1
1
State: 2
Acc-Sig: +0
2
2
2
2
EOF
run 0 ../ltl2tgba -XD dra.dstar | tee stdout
cat >expected <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="a & !b"]
0 -> 1 [label="!a & !b"]
0 -> 2 [label="b"]
1 [label="1"]
1 -> 1 [label="1"]
2 [label="2"]
2 -> 2 [label="1"]
}
EOF
diff expected stdout
run 0 ../ltl2tgba -XDD dra.dstar | tee stdout
cat >expected <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="a & !b"]
0 -> 1 [label="b"]
1 [label="1", peripheries=2]
1 -> 1 [label="1"]
}
EOF
diff expected stdout
# DSA generated with
# ltlfilt -f 'FGa' -l |
# ltl2dstar --automata=streett --ltl2nba=spin:path/ltl2tgba@-s - -
cat >dsa.dstar <<EOF
DSA v2 explicit
Comment: "Streett{Safra[NBA=2]}"
States: 3
Acceptance-Pairs: 1
Start: 1
AP: 1 "a"
---
State: 0
Acc-Sig: +0
0
2
State: 1
Acc-Sig:
0
0
State: 2
Acc-Sig:
0
2
EOF
run 0 ../ltl2tgba -XDB dsa.dstar | tee stdout
cat >expected <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 1 [label="1"]
0 -> 2 [label="1"]
1 [label="1"]
1 -> 1 [label="!a"]
1 -> 2 [label="!a"]
1 -> 3 [label="a"]
1 -> 4 [label="a"]
2 [label="2"]
2 -> 5 [label="!a"]
2 -> 4 [label="a\n{0}"]
3 [label="3"]
3 -> 1 [label="!a"]
3 -> 2 [label="!a"]
3 -> 3 [label="a"]
3 -> 4 [label="a"]
4 [label="4"]
4 -> 5 [label="!a"]
4 -> 4 [label="a\n{0}"]
5 [label="5"]
5 -> 5 [label="!a"]
5 -> 6 [label="a"]
6 [label="6"]
6 -> 5 [label="!a"]
6 -> 6 [label="a"]
}
EOF
diff expected stdout
test "`../../bin/dstar2tgba -D dsa.dstar --stats '%s %t %p %d'`" = "2 5 0 0"
test "`../../bin/dstar2tgba -DC dsa.dstar --stats '%s %t %p %d'`" = "3 8 1 0"
# DRA generated with
# ltlfilt -f 'Ga | Fb' -l | ltl2dstar --ltl2nba=spin:path/ltl2tgba@-sD - -
# (State name and comments added by hand to test the parser.)
cat >dra.dstar <<EOF
DRA v2 explicit
Comment: "Union{Safra[NBA=1],Safra[NBA=2]}"
States: 5
Acceptance-Pairs: 2
Start: 0
AP: 2 "a" "b"
---
State: 0 "bla"
Acc-Sig:
1
2 /* This is a comment */
3
4
State: 1 "foo"
Acc-Sig: -0
1
1 // This is another comment.
3
3
State: 2 "baz"
Acc-Sig: +0
1
2
// more
/// comment
3
4
State: 3 "str\n\"ing"
Acc-Sig: -0 +1
3 /***
**** Some multiline comment
***/
3
3
3
State: 4 "more\"string\""
Acc-Sig: +0 +1
3
4
3
4
EOF
run 0 ../ltl2tgba -XDD dra.dstar | tee stdout
cat >expected <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 1 [label="!a & !b"]
0 -> 2 [label="a & !b"]
0 -> 3 [label="!a & b"]
0 -> 4 [label="a & b"]
1 [label="1"]
1 -> 1 [label="!b"]
1 -> 3 [label="b"]
2 [label="2", peripheries=2]
2 -> 1 [label="!a & !b"]
2 -> 2 [label="a & !b"]
2 -> 3 [label="!a & b"]
2 -> 4 [label="a & b"]
3 [label="3", peripheries=2]
3 -> 3 [label="1"]
4 [label="4", peripheries=2]
4 -> 3 [label="!a"]
4 -> 4 [label="a"]
}
EOF
diff expected stdout
test "`../../bin/dstar2tgba --name=%F -D dra.dstar --stats '%s %t %p %d %m'`" \
= "3 12 1 1 dra.dstar"
# This has caused a crash at some point when dealing with 0-sized
# bitsets to represent acceptance sets.
cat >aut.dsa <<EOF
DSA v2 explicit
Comment: "Streett{Safra[NBA=1]}"
States: 1
Acceptance-Pairs: 0
Start: 0
AP: 0
---
State: 0
Acc-Sig:
0
EOF
run 0 ../../bin/dstar2tgba --name=%F --dot=nt aut.dsa | tee stdout
cat >expected<<EOF
digraph G {
rankdir=LR
label="aut.dsa"
labelloc="t"
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="1"]
}
EOF
diff expected stdout

48
src/tests/dupexp.test Executable file
View file

@ -0,0 +1,48 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2014, 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# 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 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
dorun()
{
run 0 ../ltl2tgba -f -s "$1" >output1
run 0 ../ltl2tgba -f -S "$1" >output2
test `wc -l <output1` = `wc -l <output2`
}
dorun 'a'
dorun 'a U b'
dorun 'X a'
dorun 'a & b & c'
dorun 'a | b | (c U (d & (g U (h ^ i))))'
dorun 'Xa & (b U !a) & (b U !a)'
dorun 'Fa & Xb & GFc & Gd'
dorun 'Fa & Xa & GFc & Gc'
dorun 'Fc & X(a | Xb) & GF(a | Xb) & Gc'
dorun '!((FF a) <=> (F x))'
dorun '!((FF a) <=> (F a))'
dorun 'Xa && (!a U b) && !b && X!b'
dorun '(a U !b) && Gb'

213
src/tests/emptchk.cc Normal file
View file

@ -0,0 +1,213 @@
// -*- 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/>.
#include <iostream>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include "ltlparse/public.hh"
#include "ltlast/allnodes.hh"
#include "twaalgos/ltl2tgba_fm.hh"
#include "twaalgos/ltl2taa.hh"
#include "twaalgos/sccfilter.hh"
#include "twaalgos/degen.hh"
#include "twa/twaproduct.hh"
#include "twaalgos/gtec/gtec.hh"
#include "twaalgos/dotty.hh"
#include "twaalgos/emptiness.hh"
void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
if (argc != 2)
syntax(argv[0]);
std::ifstream input(argv[1]);
if (!input)
{
std::cerr << "failed to open " << argv[1] << '\n';
return 2;
}
auto d = spot::make_bdd_dict();
std::string s;
unsigned line = 0;
while (std::getline(input, s))
{
++line;
std::cout << "========================================================\n";
std::cout << line << ": " << s << '\n';
if (s.empty() || s[0] == '#') // Skip comments
continue;
std::vector<std::string> tokens;
{
std::istringstream ss(s);
std::string form;
while (std::getline(ss, form, ','))
{
std::string tmp;
while (form.size() > 0 && form.back() == '\\'
&& std::getline(ss, tmp, ','))
{
form.back() = ',';
form += tmp;
}
tokens.push_back(form);
}
}
if (tokens.size() != 2)
{
std::cerr << "Expecting two tokens on input line.\n";
exit(2);
}
int runs = atoi(tokens[0].c_str());
spot::ltl::parse_error_list pe;
auto f = spot::ltl::parse(tokens[1], pe);
if (spot::ltl::format_parse_errors(std::cerr, tokens[1], pe))
return 2;
auto d = spot::make_bdd_dict();
// Build many different automata from this formula.
spot::const_twa_ptr aut[4];
{
auto a = spot::ltl_to_taa(f, d);
aut[0] = a;
auto all = spot::twa::prop_set::all();
aut[1] = spot::degeneralize_tba(spot::make_twa_graph(a, all));
}
{
auto a = spot::ltl_to_tgba_fm(f, d);
aut[2] = a;
aut[3] = spot::degeneralize(a);
}
const char* algos[] = {
"Cou99", "Cou99(shy)",
"CVWY90", "CVWY90(bsh=10M)", "CVWY90(repeated)",
"SE05", "SE05(bsh=10M)", "SE05(repeated)",
"Tau03_opt", "GV04",
};
for (auto& algo: algos)
{
const char* err;
auto i = spot::make_emptiness_check_instantiator(algo, &err);
if (!i)
{
std::cerr << "Failed to parse `" << err << '\'' << std::endl;
exit(2);
}
for (unsigned j = 0; j < sizeof(aut)/sizeof(*aut); ++j)
{
auto a = aut[j];
std::cout << "** Testing aut[" << j << "] using " << algo << '\n';
unsigned n_acc = a->acc().num_sets();
unsigned n_max = i->max_acceptance_conditions();
if (n_max < n_acc)
{
std::cout << "Skipping because automaton has " << n_acc
<< " acceptance sets, and " << algo
<< " accepts at most " << n_max << ".\n";
continue;
}
unsigned n_min = i->min_acceptance_conditions();
if (n_min > n_acc)
{
std::cout << "Skipping because automaton has " << n_acc
<< " acceptance sets, and " << algo
<< " wants at least " << n_min << ".\n";
continue;
}
auto ec = i->instantiate(a);
bool search_many = i->options().get("repeated");
assert(ec);
int ce_found = 0;
do
{
if (auto res = ec->check())
{
++ce_found;
std::cout << ce_found << " counterexample found\n";
if (auto run = res->accepting_run())
{
auto ar = spot::tgba_run_to_tgba(a, run);
spot::dotty_reachable(std::cout, ar);
}
std::cout << '\n';
if (runs == 0)
{
std::cerr << "ERROR: Expected no counterexample.\n";
exit(1);
}
}
else
{
if (ce_found)
std::cout << "No more counterexample found.\n\n";
else
std::cout << "No counterexample found.\n\n";
break;
}
}
while (search_many);
// The expected number of runs is only for TAA translations
if (search_many && runs > ce_found && j < 2)
{
std::cerr << "ERROR: only " << ce_found
<< " counterexamples founds, expected at least "
<< runs << '\n';
exit(1);
}
if (!search_many && ec->safe() && runs && !ce_found)
{
std::cerr << "ERROR: expected a counterexample.\n";
exit(1);
}
}
}
f->destroy();
}
spot::ltl::atomic_prop::dump_instances(std::cerr);
spot::ltl::unop::dump_instances(std::cerr);
spot::ltl::binop::dump_instances(std::cerr);
spot::ltl::multop::dump_instances(std::cerr);
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
return 0;
}

44
src/tests/emptchk.test Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2008, 2009, 2010, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 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 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
cat > emptchk.txt <<EOF
1, a
1, a U b
1, X a
1, a & b & c
1, a | b | (c U (d & (g U (h ^ i))))
1, Xa & (b U !a) & (b U !a)
1, Fa & Xb & GFc & Gd
2, Fa & Xa & GFc & Gc
1, Fc & X(a | Xb) & GF(a | Xb) & Gc
2, !((FF a) <=> (F x))
0, Xa && (!a U b) && !b && X!b
0, (a U !b) && Gb
EOF
run 0 ../emptchk emptchk.txt

220
src/tests/emptchke.test Executable file
View file

@ -0,0 +1,220 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2014, 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 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 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
expect_ce()
{
run 0 ../ltl2tgba -CR -e -XH "$1"
run 0 ../ltl2tgba -CR -e -DT -XH "$1"
run 0 ../ltl2tgba -CR -e'Cou99(shy)' -XH "$1"
run 0 ../ltl2tgba -CR -e'Cou99(shy)' -DT -XH "$1"
run 0 ../ltl2tgba -CR -eCVWY90 -XH "$1"
run 0 ../ltl2tgba -CR -eGV04 -XH "$1"
run 0 ../ltl2tgba -CR -eSE05 -XH "$1"
run 0 ../ltl2tgba -CR -eTau03 -XH "$1"
}
cat >input <<'EOF'
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {0 1}
[0&!1] 1
State: 1 {0}
[0] 2
State: 2
[t] 0
--END--
EOF
expect_ce input
# ________
# / v
# >a--->d--->g
# /^ /^ /^
# L | L | L |{A}
# b->c e->f h->i
#
cat >input <<'EOF'
HOA: v1
States: 9
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0
[t] 1
[t] 3
[t] 6
State: 1
[t] 2
State: 2
[t] 0
State: 3
[t] 4
[t] 6
State: 4
[t] 5
State: 5
[t] 3
State: 6
[t] 7
State: 7
[t] 8
State: 8 {0}
[t] 6
--END--
EOF
expect_ce input
# v
# d->a
# ^ |
# | v
# c<-b<-.
# ^ |A |B
# B| v |
# `--e->f
#
# The arcs are ordered so that Couvreur99 succeed after exploring
# the following subgraph (which is one accepting SCC):
#
# v
# d->a
# ^ |
# | v
# c<-b<-.
# |A |B
# v |
# e->f
#
# However when computing a counter-example the greedy BFS algorithm
# will fail to return the minimal a->b->e->f->b run. Indeed it first
# walks through a->b->e (which gives acceptance condition A), and
# prefer to continue with e->c (because it gives acceptance condition B),
# and finally closes the cycle with c->d->a
#
cat >input <<'EOF'
HOA: v1
States: 6
Start: 0
AP: 0
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc complete
--BODY--
State: 0
[t] 1
State: 1
[t] 2
[t] 4 {0}
State: 2
[t] 3
State: 3
[t] 0
State: 4
[t] 2 {1}
[t] 5
State: 5
[t] 1 {1}
--END--
EOF
expect_ce input
# This graph was randomly generated, and contains one accepting path.
# It triggered a bug in our implementation of GV04 (that didn't see any
# accepting path).
cat >input <<EOF
HOA: v1
States: 20
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 1
State: 1
[t] 2
[t] 3
State: 2
[t] 4
[t] 5 {0}
[t] 6
State: 3
[t] 6
[t] 7
State: 4
[t] 8
State: 5
[t] 9
State: 6
[t] 2
State: 7
[t] 10
[t] 11
State: 8
[t] 12
State: 9
[t] 13
State: 10
[t] 13
[t] 14
[t] 15
State: 11
[t] 2
State: 12
[t] 3
State: 13
[t] 16
State: 14
State: 15
[t] 4
State: 16
[t] 17
State: 17
[t] 18
State: 18
[t] 10
[t] 19
State: 19
--END--
EOF
expect_ce input

55
src/tests/emptchkr.test Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2015 Laboratoire de Recherche de
# Développement de l'Epita (LRDE).
# Copyright (C) 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 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/>.
# Emptiness check on randomly generated state spaces.
. ./defs
set -e
# With no acceptance condition, everyone should agree and find a run.
# Do not spend to much time checking this.
run 0 ../randtgba -e 10 -s 0 -r -m
# Test some statistic output
run 0 ../randtgba -z -e 10 -s 0 -r -m
run 0 ../randtgba -1 -e 10 -s 0 -r -m
# One acceptance condition
run 0 ../randtgba -e 100 -s 0 -r -m -a 1 0.1 -d 0.01
run 0 ../randtgba -e 100 -s 50 -r -m -a 1 0.1 -d 0.02
run 0 ../randtgba -e 100 -s 100 -r -m -a 1 0.1 -d 0.04
run 0 ../randtgba -e 100 -s 150 -r -m -a 1 0.1 -d 0.08
# Four acceptance conditions
run 0 ../randtgba -e 100 -s 200 -r -m -a 4 0.1 -d 0.01
run 0 ../randtgba -e 100 -s 250 -r -m -a 4 0.1 -d 0.02
run 0 ../randtgba -e 100 -s 300 -r -m -a 4 0.1 -d 0.04
run 0 ../randtgba -e 100 -s 350 -r -m -a 4 0.1 -d 0.08
run 0 ../randtgba -e 100 -s 400 -r -m -a 4 0.2 -d 0.01
run 0 ../randtgba -e 100 -s 450 -r -m -a 4 0.2 -d 0.02
run 0 ../randtgba -e 100 -s 500 -r -m -a 4 0.2 -d 0.04
run 0 ../randtgba -e 100 -s 550 -r -m -a 4 0.2 -d 0.08
# Bigger automata. With valgrind this is slow, so we do less.
run 0 ../randtgba -e 10 -s 0 -n 500 -r -m -a 1 0.0003 -d 0.01
run 0 ../randtgba -e 10 -s 0 -n 500 -r -m -a 4 0.0011 -D -d 0.01

162
src/tests/exclusive-tgba.test Executable file
View file

@ -0,0 +1,162 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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 || exit 1
set -e
cat >automaton <<EOF
HOA: v1
States: 4
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
--BODY--
State: 0
[0] 1
State: 1
[1] 2
[2&!1] 2
State: 2 {0}
[1] 2
[0&1] 1
[1&2] 3
State: 3
[t] 3
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0&!1&!2] 1
State: 1
[!0&1&!2] 2
[!0&!1&2] 2
State: 2 {0}
[!0&1&!2] 2
--END--
EOF
cat >expected-simpl <<EOF
HOA: v1
States: 3
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0] 1
State: 1
[1 | 2] 2
State: 2 {0}
[1] 2
--END--
EOF
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
automaton >out
cat out
diff out expected
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
--simplify-exclusive-ap automaton >out2
cat out2
diff out2 expected-simpl
cat >automaton <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
--BODY--
State: 0
[0] 1
State: 1
[1] 2
[0&!1] 2
State: 2 {0}
[1] 2
[0&1] 1
[1&0] 3
State: 3
[t] 3
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0&!1] 1
State: 1
[!0&1] 2
[0&!1] 2
State: 2 {0}
[!0&1] 2
--END--
EOF
cat >expected-simpl <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0] 1
State: 1
[0 | 1] 2
State: 2 {0}
[1] 2
--END--
EOF
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
automaton >out
cat out
diff out expected
run 0 ../../bin/autfilt -H --exclusive-ap=a,b,c --exclusive-ap=d,e \
--simplify-exclusive-ap automaton >out2
cat out2
diff out2 expected-simpl

83
src/tests/explpro2.test Executable file
View file

@ -0,0 +1,83 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 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 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
cat >input1 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[!0] 1 {0}
[!1] 2 {1}
State: 1
State: 2
--END--
EOF
cat >input2 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {1}
State: 1
State: 2
--END--
EOF
cat >expected <<'EOF'
HOA: v1
States: 3
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels trans-acc deterministic
--BODY--
State: 0
[0&!1] 1 {0 2}
[!0&1] 2 {1 3}
State: 1
State: 2
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input1 input2 stdout expected

82
src/tests/explpro3.test Executable file
View file

@ -0,0 +1,82 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# 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 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
cat >input1 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[!0] 1
[!1] 2
State: 1
State: 2
--END--
EOF
cat >input2 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {1}
State: 1
State: 2
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc deterministic
--BODY--
State: 0
[0&!1] 1 {0}
[!0&1] 2 {1}
State: 1
State: 2
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input1 input2 stdout expected

91
src/tests/explpro4.test Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2014, 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2006 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 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
cat >input1 <<EOF
HOA: v1
States: 1
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[!0] 0
[0] 0 {0}
--END--
EOF
cat >input2 <<EOF
HOA: v1
States: 1
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[0] 0
[!0] 0 {0}
--END--
EOF
cat >expected <<'EOF'
HOA: v1
States: 1
Start: 0
AP: 1 "a"
Acceptance: 2 Inf(0) & Fin(1)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[!0] 0 {1}
[0] 0 {0}
--END--
EOF
cat >unexpected <<'EOF'
HOA: v1
States: 1
Start: 0
AP: 1 "a"
Acceptance: 2 Inf(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[!0] 0 {1}
[0] 0 {0}
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
run 0 ../../bin/autfilt -q stdout --isomorph expected
run 1 ../../bin/autfilt -q stdout --isomorph unexpected
true

102
src/tests/explprod.test Executable file
View file

@ -0,0 +1,102 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2008, 2009, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 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 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
cat >input1 <<EOF
HOA: v1
States: 3
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 {0}
[0] 1
[1] 2
State: 1
State: 2 {0}
[!0] 0
[2] 1
--END--
EOF
cat >input2 <<EOF
HOA: v1
States: 2
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {0}
[0] 1
State: 1 {1}
[1] 0
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 4
Start: 0
AP: 3 "b" "a" "c"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 {0 1}
[0&1] 1
[0] 2
State: 1
State: 2 {0 2}
[1&2] 3
State: 3
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --hoa | tee stdout
diff stdout expected
cat >expected <<EOF
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --hoa --small | tee stdout
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input1 input2 stdout expected

1674
src/tests/hoaparse.test Executable file

File diff suppressed because it is too large Load diff

133
src/tests/intvcmp2.cc Normal file
View file

@ -0,0 +1,133 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement
// 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/>.
#include <iostream>
#include "misc/intvcmp2.hh"
#include <cstring>
int check_aa(int* data, int size, unsigned expected = 0)
{
int* comp = new int[size * 2];
size_t csize = size * 2;
spot::int_array_array_compress2(data, size, comp, csize);
std::cout << "AC[" << csize << "] ";
for (size_t i = 0; i < csize; ++i)
std::cout << comp[i] << ' ';
std::cout << std::endl;
int* decomp = new int[size + 30];
spot::int_array_array_decompress2(comp, csize, decomp, size);
std::cout << "AD[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << decomp[i] << ' ';
std::cout << std::endl;
int res = memcmp(data, decomp, size * sizeof(int));
if (res)
{
std::cout << "*** cmp error *** " << res << std::endl;
std::cout << "AE[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << data[i] << ' ';
std::cout << std::endl;
}
if (expected && (csize * sizeof(int) != expected))
{
std::cout << "*** size error *** (expected "
<< expected << " bytes, got " << csize * sizeof(int)
<< " bytes)" << std::endl;
res = 1;
}
std::cout << std::endl;
delete[] comp;
delete[] decomp;
return !!res;
}
int check(int* comp, int size, unsigned expected = 0)
{
return
//check_vv(comp, size, expected) +
//check_av(comp, size, expected) +
check_aa(comp, size, expected);
}
int main()
{
int errors = 0;
int comp1[] = { 1, 0, 0, 0, 0, 0, 3, 3, 4, 0, 0, 0 };
errors += check(comp1, sizeof(comp1) / sizeof(*comp1));
int comp2[] = { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 1 };
errors += check(comp2, sizeof(comp2) / sizeof(*comp2));
int comp3[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1,
0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1,
0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0 };
errors += check(comp3, sizeof(comp3) / sizeof(*comp3));
int comp4[] = { 1, 2, 1, 2, 1, 2, 2, 0 }; // 32 bits
errors += check(comp4, sizeof(comp4) / sizeof(*comp4), 4);
int comp5[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 64 bits
errors += check(comp5, sizeof(comp5) / sizeof(*comp5), 8);
int comp6[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0,
1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 128 bits
errors += check(comp6, sizeof(comp6) / sizeof(*comp6), 16);
int comp7[] = { 4, 8, 10, 3, 49, 50, 0, 20, 13 };
errors += check(comp7, sizeof(comp7) / sizeof(*comp7));
int comp8[] = { 4959, 6754, 8133, 10985, 11121, 14413, 17335, 20754,
21317, 30008, 30381, 33494, 34935, 41210, 41417 };
errors += check(comp8, sizeof(comp8) / sizeof(*comp8));
int comp9[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
errors += check(comp9, sizeof(comp9) / sizeof(*comp9));
int comp10[] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 9 };
errors += check(comp10, sizeof(comp10) / sizeof(*comp10));
int comp11[] = { 2, 254, 254, 0, 1, 4, 0, 0, 0, 1, 0, 1, 253, 0 };
errors += check(comp11, sizeof(comp11) / sizeof(*comp11));
return errors;
}

221
src/tests/intvcomp.cc Normal file
View file

@ -0,0 +1,221 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement
// 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/>.
#include <iostream>
#include "misc/intvcomp.hh"
#include <cstring>
int check_vv(int* data, int size, unsigned expected = 0)
{
std::vector<int> input;
input.reserve(size);
for (int i = 0; i < size; ++i)
input.push_back(data[i]);
std::vector<unsigned int> output;
spot::int_vector_vector_compress(input, output);
std::cout << "WC[" << output.size() << "] ";
for (size_t i = 0; i < output.size(); ++i)
std::cout << output[i] << ' ';
std::cout << '\n';
std::vector<int> decomp;
spot::int_vector_vector_decompress(output, decomp, size);
std::cout << "WD[" << decomp.size() << "] ";
for (size_t i = 0; i < decomp.size(); ++i)
std::cout << decomp[i] << ' ';
std::cout << '\n';
int res = (decomp != input);
if (res)
{
std::cout << "*** cmp error *** " << std::endl;
std::cout << "WE[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << data[i] << ' ';
std::cout << '\n';
}
if (expected && (output.size() * sizeof(int) != expected))
{
std::cout << "*** size error *** (expected "
<< expected << " bytes, got " << output.size() * sizeof(int)
<< " bytes)" << std::endl;
res = 1;
}
std::cout << '\n';
return !!res;
}
int check_av(int* data, int size, unsigned expected = 0)
{
const std::vector<unsigned int>* v =
spot::int_array_vector_compress(data, size);
std::cout << "VC[" << v->size() << "] ";
for (size_t i = 0; i < v->size(); ++i)
std::cout << (*v)[i] << ' ';
std::cout << '\n';
int* decomp = new int[size];
spot::int_vector_array_decompress(v, decomp, size);
std::cout << "VD[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << decomp[i] << ' ';
std::cout << '\n';
int res = memcmp(data, decomp, size * sizeof(int));
if (res)
{
std::cout << "*** cmp error *** " << res << std::endl;
std::cout << "VE[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << data[i] << ' ';
std::cout << '\n';
}
if (expected && (v->size() * sizeof(int) != expected))
{
std::cout << "*** size error *** (expected "
<< expected << " bytes, got " << v->size() * sizeof(int)
<< " bytes)" << std::endl;
res = 1;
}
std::cout << '\n';
delete v;
delete[] decomp;
return !!res;
}
int check_aa(int* data, int size, unsigned expected = 0)
{
int* comp = new int[size *2];
size_t csize = size * 2;
spot::int_array_array_compress(data, size, comp, csize);
std::cout << "AC[" << csize << "] ";
for (size_t i = 0; i < csize; ++i)
std::cout << comp[i] << ' ';
std::cout << '\n';
int* decomp = new int[size];
spot::int_array_array_decompress(comp, csize, decomp, size);
std::cout << "AD[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << decomp[i] << ' ';
std::cout << '\n';
int res = memcmp(data, decomp, size * sizeof(int));
if (res)
{
std::cout << "*** cmp error *** " << res << std::endl;
std::cout << "AE[" << size << "] ";
for (int i = 0; i < size; ++i)
std::cout << data[i] << ' ';
std::cout << '\n';
}
if (expected && (csize * sizeof(int) != expected))
{
std::cout << "*** size error *** (expected "
<< expected << " bytes, got " << csize * sizeof(int)
<< " bytes)" << std::endl;
res = 1;
}
std::cout << '\n';
delete[] comp;
delete[] decomp;
return !!res;
}
int check(int* comp, int size, unsigned expected = 0)
{
return
check_vv(comp, size, expected) +
check_av(comp, size, expected) +
check_aa(comp, size, expected);
}
int main()
{
int errors = 0;
int comp1[] = { 1, 0, 0, 0, 0, 0, 3, 3, 4, 0, 0, 0 };
errors += check(comp1, sizeof(comp1) / sizeof(*comp1));
int comp2[] = { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 1 };
errors += check(comp2, sizeof(comp2) / sizeof(*comp2));
int comp3[] = { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1,
0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1,
0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0 };
errors += check(comp3, sizeof(comp3) / sizeof(*comp3));
int comp4[] = { 1, 2, 1, 2, 1, 2, 2, 0 }; // 32 bits
errors += check(comp4, sizeof(comp4) / sizeof(*comp4), 4);
int comp5[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 64 bits
errors += check(comp5, sizeof(comp5) / sizeof(*comp5), 8);
int comp6[] = { 1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0,
1, 2, 1, 2, 1, 2, 2, 0, 1, 2, 1, 2, 1, 2, 2, 0 }; // 128 bits
errors += check(comp6, sizeof(comp6) / sizeof(*comp6), 16);
int comp7[] = { -4, -8, -10, 3, 49, 50, 0, 20, 13 };
errors += check(comp7, sizeof(comp7) / sizeof(*comp7));
int comp8[] = { 4959, 6754, 8133, 10985, 11121, 14413, 17335, 20754,
21317, 30008, 30381, 33494, 34935, 41210, 41417 };
errors += check(comp8, sizeof(comp8) / sizeof(*comp8));
int comp9[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
errors += check(comp9, sizeof(comp9) / sizeof(*comp9));
int comp10[] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 9 };
errors += check(comp10, sizeof(comp10) / sizeof(*comp10));
return errors;
}

27
src/tests/intvcomp.test Executable file
View file

@ -0,0 +1,27 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 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
run 0 ../intvcomp
run 0 ../intvcmp2

108
src/tests/isomorph.test Executable file
View file

@ -0,0 +1,108 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2014 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 i in 0 1 2; do
../../bin/randaut a b --seed=$i -S10 --hoa >iso$i
../../bin/autfilt iso$i --randomize --hoa >aut$i
done
for i in 3 4 5; do
../../bin/randaut a b --seed=$i -S10 -D --hoa >iso$i
../../bin/autfilt iso$i --randomize --hoa >aut$i
done
cat aut0 aut1 aut2 aut3 aut4 aut5 > all
(for i in 0 1 2 3 4 5; do
run 0 ../../bin/autfilt all --are-isomorphic iso$i --hoa
done) > output
diff all output
# Test if two isomorphic automata with different initial states are detected.
cat >aut1 <<EOF
HOA: v1
name: "1"
States: 4
Start: 1
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0 [t] 1 [t] 1
State: 1 [t] 2 [t] 2
State: 2 [t] 3 [t] 3
State: 3 [t] 0 [t] 0
--END--
EOF
cat >aut2 <<EOF
HOA: v1
name: "1"
States: 4
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0 [t] 1 [t] 1
State: 1 [t] 3 [t] 3
State: 3 [t] 2 [t] 2
State: 2 [t] 0 [t] 0
--END--
EOF
# Check that the number of ingoing and outgoing transitions of a state matters,
# even if they behave similarly.
cat >aut3 <<EOF
HOA: v1
States: 3
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0 [t] 1 [t] 2
State: 1 [t] 1 [t] 1
State: 2 [t] 2
--END--
EOF
cat >aut4 <<EOF
HOA: v1
States: 3
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0 [t] 1 [t] 2
State: 1 [t] 1
State: 2 [t] 2 [t] 2
--END--
EOF
run 0 ../../bin/autfilt aut1 --are-isomorphic aut2
run 0 ../../bin/autfilt aut3 --are-isomorphic aut4

55
src/tests/kv.test Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
# Développement de l'EPITA.
#
# 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
check ()
{
run 0 ../ltl2tgba -f -KV "$1" > out.dot
test -z "$DOT" || "$DOT" out.dot > /dev/null
rm -f out.dot
}
# We don't check the output, but running these might be
# enough to trigger assertions in the code, or raise valgrind concerns.
check 'a R (b R c)'
check '(a U b) U (c U d)'
check '((Xp2)U(X(1)))&(p1 R(p2 R p0))'
# Make sure escaped variables print OK.
check '"G1"U"GG" && "FF"'
# Make sure we count 4 atomic propositions in
# G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"
# even after iterated simulation
# Report from Etienne Renault.
../ltl2tgba -KV -R3 -RIS >out \
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'
x=`sed -n '/APrec/{
s/.*APrec=\[\([^]]*\)\].*/\1/p
q
}' out | tr ' ' '\n' | wc -l`
test "$x" -eq 4

176
src/tests/lbttparse.test Executable file
View file

@ -0,0 +1,176 @@
#!/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 ../../bin/ltl2tgba --lbtt "$f" > out
s=`wc -l < out`
head -n 1 out | grep t
run 0 ../../bin/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 ../../bin/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 ../../bin/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 ../../bin/autfilt --lbtt out4 > out5
run 0 ../../bin/autfilt out4 --are-isomorphic out5
# ... unless --lbtt=t is used.
run 0 ../../bin/ltl2tgba --ba --lbtt=t --low --any "$f" >out6
head -n 1 out6 | grep t
s6=`wc -l < out6`
test "$s" -eq "$s6"
run 0 ../../bin/autfilt --lbtt out6 > out7
run 0 ../../bin/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 ../../bin/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
../../bin/autfilt -q input 2> stderr && exit 1
cat stderr
diff stderr expected

77
src/tests/ltl2dstar.test Executable file
View file

@ -0,0 +1,77 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 2014 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/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
# Skip this test if ltl2dstar is not installed.
(ltl2dstar --version) || exit 77
ltlfilt=../../bin/ltlfilt
ltl2tgba=../../bin/ltl2tgba
ltlcross=../../bin/ltlcross
randltl=../../bin/randltl
ltlfilt=../../bin/ltlfilt
dstar2tgba=../../bin/dstar2tgba
$ltlfilt -f 'a U b' -l |
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - - |
$dstar2tgba --stats '%s %e %t %a %d' |
tee out
test "`cat out`" = '2 3 7 1 1'
RAB=--automata=rabin
STR=--automata=streett
$randltl -n 15 a b | $ltlfilt --nnf --remove-wm |
$ltlcross -F - -f 'GFa & GFb & GFc' -f '(GFa -> GFb) & (GFc -> GFd)' \
--timeout=30 \
"$ltl2tgba -s %f >%N" \
"ltl2dstar $RAB --output=nba --ltl2nba=spin:$ltl2tgba@-s %L %T" \
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L - | $dstar2tgba --low -s >%N" \
"ltl2dstar $STR --output=nba --ltl2nba=spin:$ltl2tgba@-s %L %T" \
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" \
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L - | $dstar2tgba --low -s >%N" \
--csv=out.csv
grep '"in_type"' out.csv
grep '"DSA"' out.csv
grep '"DRA"' out.csv
grep ',,,,' out.csv
# A bug in ltlcross <=1.2.5 caused it to not use the complement of the
# negative automaton. So running ltlcross with GFa would check one
# complement (the positive one), but running with FGa would ignore
# the negative complement.
$ltlcross -f 'GFa' --verbose \
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" 2>err
test `grep -c 'info: check_empty.*Comp' err` = 1
$ltlcross -f 'FGa' --verbose \
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %D" \
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %D" 2>err
test `grep -c 'info: check_empty.*Comp' err` = 1

100
src/tests/ltl2dstar2.test Executable file
View file

@ -0,0 +1,100 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 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/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
# Skip this test if ltl2dstar is not installed.
(ltl2dstar --version) || exit 77
ltlfilt=../../bin/ltlfilt
ltl2tgba=../../bin/ltl2tgba
dstar2tgba=../../bin/dstar2tgba
randltl=../../bin/randltl
# Make sure all recurrence formulas are translated into deterministic
# Büchi automata by the DRA->TGBA converter.
# (Note that ltl2tgba is not called with -D when want to make
# sure we get a deterministic output even if the automaton generated
# by Spot initially was non-deterministic)
$randltl -n -1 a b --tree-size=5..15 |
$ltlfilt --syntactic-recurrence --remove-wm -r -u \
--size-min=4 --size-max=15 --relabel=abc |
head -n 20 > formulas
$randltl -n -1 a b --tree-size=5..15 |
$ltlfilt -v --obligation |
$ltlfilt --syntactic-recurrence --remove-wm -r -u \
--size-min=4 --size-max=15 --relabel=abc |
head -n 20 >> formulas
while read f; do
$ltlfilt -f "$f" -l |
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - foo
echo "$f"
det=`$dstar2tgba foo --stats '%d'`
test $det -eq 1;
done < formulas
echo ==========================
# For obligation formulas, the output of dstar2tgba should
# have the same size as the input when option -D is used.
$randltl -n -1 a b --tree-size=5..15 |
$ltlfilt --obligation --size-min=4 --size-max=15 --relabel=abc \
--remove-wm -r -u |
head -n 20 > formulas
while read f; do
expected=`$ltl2tgba "$f" -BD --stats '%s %e 1 %d'`
$ltlfilt -f "$f" -l |
ltl2dstar --ltl2nba=spin:$ltl2tgba@-Ds - foo
echo "$f"
output=`$dstar2tgba foo -BD --stats '%s %e %d 1'`
# the '1 %d' matching '%d 1' makes sure input and output are deterministic.
test "$output" = "$expected";
done < formulas
echo ==========================
# Now make sure that some obviously non-deterministic property
# are not translated to deterministic.
cat >formulas <<EOF
FGa
GFa->GFb
GFa & FGb
FGa | FGb
FGa & FGb
EOF
while read f; do
$ltlfilt -f "$f" -l |
ltl2dstar --ltl2nba=spin:$ltl2tgba@-s - foo
echo "$f"
det=`$dstar2tgba foo --stats '%d'`
test $det -eq 0;
done < formulas

48
src/tests/ltl2dstar3.test Executable file
View file

@ -0,0 +1,48 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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/>.
# Test ltl2dstar's HOA output with ltlcross.
. ./defs
set -e
# Skip this test if ltl2dstar is not installed.
(ltl2dstar --version) || exit 77
ltlfilt=../../bin/ltlfilt
ltl2tgba=../../bin/ltl2tgba
ltlcross=../../bin/ltlcross
randltl=../../bin/randltl
ltlfilt=../../bin/ltlfilt
dstar2tgba=../../bin/dstar2tgba
RAB='--automata=rabin --output-format=hoa'
STR='--automata=streett --output-format=hoa'
# Run ltlcross without product, because this requires too much memory.
$randltl -n 25 a b | $ltlfilt --remove-wm |
$ltlcross -F- -f 'GFa & GFb & GFc' -f '(GFa -> GFb) & (GFc -> GFd)' \
--timeout=30 --verbose --csv=out.csv --products=0 \
"$ltl2tgba -s %f >%N" \
"ltl2dstar $RAB --ltl2nba=spin:$ltl2tgba@-s %L %H" \
"ltl2dstar $STR --ltl2nba=spin:$ltl2tgba@-s %L %H"
grep '"in_type"' out.csv && exit 1
exit 0

View file

@ -0,0 +1,103 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2012, 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 <http://www.gnu.org/licenses/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct!
# This test is separate from spotlbtt.test, because lbtt-translate
# will refuse to pass M and W to a tool (spot) that masquerades as
# Spin.
. ./defs
need_lbtt
set -e
cat > config <<EOF
Algorithm
{
Name = "Spot (Couvreur -- FM)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), with reductions"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R3f -F -f -t'"
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM), degeneralized via never claim"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spin '../ltl2tgba -F -f -N'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), reductions, degeneralized via never claim"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spin '../ltl2tgba -F -f -r4 -R3 -N'"
Enabled = yes
}
GlobalOptions
{
Rounds = 100
Interactive = Never
# Verbosity = 5
# ComparisonCheck = no
# ConsistencyCheck = no
# IntersectionCheck = no
}
FormulaOptions
{
Size = 1...13
Propositions = 6
AbbreviatedOperators = Yes
GenerateMode = Normal
OutputMode = Normal
PropositionPriority = 50
TruePriority = 1
FalsePriority = 1
AndPriority = 10
OrPriority = 10
XorPriority = 0
# EquivalencePriority = 0
BeforePriority = 0
StrongReleasePriority = 0
WeakUntilPriority = 0
DefaultOperatorPriority = 5
}
EOF
${LBTT}
rm config

35
src/tests/ltl2neverclaim.test Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2012, 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 <http://www.gnu.org/licenses/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
ltl2tgba=../ltl2tgba
../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 |
../../bin/ltlcross \
"$ltl2tgba -t %f > %T" \
"$ltl2tgba -t -r4 -R3f %f > %T" \
"$ltl2tgba -N %f > %N" \
"$ltl2tgba -N -r4 -R3f %f > %N"

438
src/tests/ltl2ta.test Executable file
View file

@ -0,0 +1,438 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 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
# This only runs various configuration of the translation algorithms
# through valgrind, and checks for differences in the size of the
# resulting automata. The actual language of the automata is not
# tested. The columns in the following table are:
# ltl2tgba options | states | transitions | acc states
cat >checkta.txt <<\EOF
in: a
-TGTA | 4 | 8 | XXX
-TGTA -RT | 2 | 3 | XXX
-TA | 3 | 3 | 3
-TA -RT | 2 | 2 | 2
-TA -lv | 3 | 3 | 2
-TA -lv -RT | 2 | 2 | 1
-TA -sp | 3 | 3 | 2
-TA -sp -RT | 2 | 2 | 1
-TA -lv -sp | 3 | 3 | 2
-TA -lv -sp -RT | 2 | 2 | 1
-TA -DS | 3 | 3 | 3
-TA -DS -RT | 2 | 2 | 2
-TA -DS -lv | 3 | 3 | 3
-TA -DS -lv -RT | 2 | 2 | 2
-TA -DS -sp | 3 | 3 | 3
-TA -DS -sp -RT | 2 | 2 | 2
-TA -DS -lv -sp | 3 | 3 | 3
-TA -DS -lv -sp -RT | 2 | 2 | 2
-x -TA -DS -in | 3 | 3 | 3
-x -TA -DS -in -RT | 2 | 2 | 2
in: a U b
-TGTA | 8 | 34 | XXX
-TGTA -RT | 4 | 18 | XXX
-TA | 7 | 20 | 6
-TA -RT | 4 | 11 | 3
-TA -lv | 8 | 22 | 5
-TA -lv -RT | 5 | 13 | 2
-TA -sp | 7 | 22 | 4
-TA -sp -RT | 4 | 13 | 1
-TA -lv -sp | 8 | 22 | 5
-TA -lv -sp -RT | 5 | 13 | 2
-TA -DS | 7 | 20 | 6
-TA -DS -RT | 4 | 11 | 3
-TA -DS -lv | 8 | 22 | 5
-TA -DS -lv -RT | 5 | 13 | 2
-TA -DS -sp | 7 | 22 | 4
-TA -DS -sp -RT | 4 | 13 | 1
-TA -DS -lv -sp | 8 | 22 | 5
-TA -DS -lv -sp -RT | 5 | 13 | 2
-x -TA -DS -in | 8 | 22 | 5
-x -TA -DS -in -RT | 5 | 13 | 2
in: F a
-TGTA | 5 | 12 | XXX
-TGTA -RT | 4 | 10 | XXX
-TA | 4 | 4 | 3
-TA -RT | 3 | 3 | 2
-TA -lv | 5 | 5 | 3
-TA -lv -RT | 4 | 4 | 2
-TA -sp | 4 | 5 | 2
-TA -sp -RT | 3 | 4 | 1
-TA -lv -sp | 5 | 5 | 3
-TA -lv -sp -RT | 4 | 4 | 2
-TA -DS | 4 | 4 | 3
-TA -DS -RT | 3 | 3 | 2
-TA -DS -lv | 5 | 5 | 3
-TA -DS -lv -RT | 4 | 4 | 2
-TA -DS -sp | 4 | 5 | 2
-TA -DS -sp -RT | 3 | 4 | 1
-TA -DS -lv -sp | 5 | 5 | 3
-TA -DS -lv -sp -RT | 4 | 4 | 2
-x -TA -DS -in | 5 | 5 | 3
-x -TA -DS -in -RT | 4 | 4 | 2
in: a & b & c
-TGTA | 10 | 74 | XXX
-TGTA -RT | 2 | 9 | XXX
-TA | 9 | 63 | 9
-TA -RT | 2 | 14 | 2
-TA -lv | 9 | 63 | 8
-TA -lv -RT | 2 | 14 | 1
-TA -sp | 9 | 63 | 8
-TA -sp -RT | 2 | 14 | 1
-TA -lv -sp | 9 | 63 | 8
-TA -lv -sp -RT | 2 | 14 | 1
-TA -DS | 9 | 63 | 9
-TA -DS -RT | 2 | 14 | 2
-TA -DS -lv | 9 | 63 | 9
-TA -DS -lv -RT | 2 | 14 | 2
-TA -DS -sp | 9 | 63 | 9
-TA -DS -sp -RT | 2 | 14 | 2
-TA -DS -lv -sp | 9 | 63 | 9
-TA -DS -lv -sp -RT | 2 | 14 | 2
-x -TA -DS -in | 9 | 63 | 9
-x -TA -DS -in -RT | 2 | 14 | 2
in: a | b | (c U (d & (g U (h ^ i))))
-TGTA | 431 | 57396 | XXX
-TGTA -RT | 10 | 1445 | XXX
-TA | 430 | 51816 | 328
-TA -RT | 126 | 15351 | 105
-TA -lv | 431 | 56744 | 129
-TA -lv -RT | 128 | 16342 | 2
-TA -sp | 430 | 56744 | 128
-TA -sp -RT | 127 | 16342 | 1
-TA -lv -sp | 431 | 56744 | 129
-TA -lv -sp -RT | 128 | 16342 | 2
-TA -DS | 430 | 51816 | 328
-TA -DS -RT | 127 | 15478 | 106
-TA -DS -lv | 431 | 56744 | 129
-TA -DS -lv -RT | 128 | 16342 | 2
-TA -DS -sp | 430 | 56744 | 128
-TA -DS -sp -RT | 127 | 16342 | 1
-TA -DS -lv -sp | 431 | 56744 | 129
-TA -DS -lv -sp -RT | 128 | 16342 | 2
-x -TA -DS -in | 431 | 56744 | 129
-x -TA -DS -in -RT | 128 | 16342 | 2
in: a & (b U !a) & (b U !a)
-TGTA | 8 | 30 | XXX
-TGTA -RT | 4 | 14 | XXX
-TA | 7 | 20 | 6
-TA -RT | 2 | 5 | 1
-TA -lv | 8 | 22 | 5
-TA -lv -RT | 4 | 10 | 2
-TA -sp | 7 | 22 | 4
-TA -sp -RT | 3 | 10 | 1
-TA -lv -sp | 8 | 22 | 5
-TA -lv -sp -RT | 4 | 10 | 2
-TA -DS | 7 | 20 | 6
-TA -DS -RT | 3 | 8 | 2
-TA -DS -lv | 8 | 22 | 5
-TA -DS -lv -RT | 4 | 10 | 2
-TA -DS -sp | 7 | 22 | 4
-TA -DS -sp -RT | 3 | 10 | 1
-TA -DS -lv -sp | 8 | 22 | 5
-TA -DS -lv -sp -RT | 4 | 10 | 2
-x -TA -DS -in | 8 | 22 | 5
-x -TA -DS -in -RT | 4 | 10 | 2
in: Fa & b & GFc & Gd
-TGTA | 21 | 219 | XXX
-TGTA -RT | 7 | 71 | XXX
-TA | 20 | 182 | 7
-TA -RT | 10 | 98 | 3
-TA -lv | 21 | 203 | 5
-TA -lv -RT | 11 | 112 | 2
-TA -sp | 20 | 194 | 4
-TA -sp -RT | 10 | 106 | 1
-TA -lv -sp | 21 | 203 | 5
-TA -lv -sp -RT | 11 | 112 | 2
-TA -DS | 28 | 294 | 15
-TA -DS -RT | 12 | 126 | 5
-TA -DS -lv | 29 | 315 | 13
-TA -DS -lv -RT | 13 | 140 | 4
-TA -DS -sp | 28 | 309 | 12
-TA -DS -sp -RT | 12 | 137 | 3
-TA -DS -lv -sp | 29 | 315 | 13
-TA -DS -lv -sp -RT | 13 | 140 | 4
-x -TA -DS -in | 29 | 254 | 9
-x -TA -DS -in -RT | 12 | 96 | 3
in: Fa & a & GFc & Gc
-TGTA | 4 | 8 | XXX
-TGTA -RT | 3 | 6 | XXX
-TA | 3 | 3 | 3
-TA -RT | 2 | 2 | 2
-TA -lv | 3 | 3 | 2
-TA -lv -RT | 2 | 2 | 1
-TA -sp | 3 | 3 | 2
-TA -sp -RT | 2 | 2 | 1
-TA -lv -sp | 3 | 3 | 2
-TA -lv -sp -RT | 2 | 2 | 1
-TA -DS | 3 | 3 | 3
-TA -DS -RT | 2 | 2 | 2
-TA -DS -lv | 3 | 3 | 2
-TA -DS -lv -RT | 2 | 2 | 1
-TA -DS -sp | 3 | 3 | 2
-TA -DS -sp -RT | 2 | 2 | 1
-TA -DS -lv -sp | 3 | 3 | 2
-TA -DS -lv -sp -RT | 2 | 2 | 1
-x -TA -DS -in | 3 | 3 | 2
-x -TA -DS -in -RT | 2 | 2 | 1
in: Fc & (a | b) & GF(a | b) & Gc
-TGTA | 8 | 34 | XXX
-TGTA -RT | 8 | 34 | XXX
-TA | 7 | 21 | 6
-TA -RT | 7 | 21 | 6
-TA -lv | 7 | 21 | 3
-TA -lv -RT | 7 | 21 | 3
-TA -sp | 7 | 21 | 3
-TA -sp -RT | 7 | 21 | 3
-TA -lv -sp | 7 | 21 | 3
-TA -lv -sp -RT | 7 | 21 | 3
-TA -DS | 11 | 51 | 10
-TA -DS -RT | 11 | 51 | 10
-TA -DS -lv | 11 | 51 | 7
-TA -DS -lv -RT | 11 | 51 | 7
-TA -DS -sp | 11 | 51 | 7
-TA -DS -sp -RT | 11 | 51 | 7
-TA -DS -lv -sp | 11 | 51 | 7
-TA -DS -lv -sp -RT | 11 | 51 | 7
-x -TA -DS -in | 11 | 33 | 5
-x -TA -DS -in -RT | 11 | 33 | 5
in: a R (b R c)
-TGTA | 17 | 124 | XXX
-TGTA -RT | 6 | 30 | XXX
-TA | 16 | 95 | 16
-TA -RT | 6 | 29 | 6
-TA -lv | 17 | 103 | 14
-TA -lv -RT | 8 | 42 | 6
-TA -sp | 16 | 103 | 13
-TA -sp -RT | 7 | 42 | 5
-TA -lv -sp | 17 | 103 | 14
-TA -lv -sp -RT | 8 | 42 | 6
-TA -DS | 16 | 95 | 16
-TA -DS -RT | 6 | 29 | 6
-TA -DS -lv | 16 | 95 | 16
-TA -DS -lv -RT | 6 | 29 | 6
-TA -DS -sp | 16 | 95 | 16
-TA -DS -sp -RT | 6 | 29 | 6
-TA -DS -lv -sp | 16 | 95 | 16
-TA -DS -lv -sp -RT | 6 | 29 | 6
-x -TA -DS -in | 16 | 92 | 16
-x -TA -DS -in -RT | 6 | 26 | 6
in: (a U b) U (c U d)
-TGTA | 77 | 1521 | XXX
-TGTA -RT | 18 | 409 | XXX
-TA | 76 | 1210 | 48
-TA -RT | 29 | 493 | 9
-TA -lv | 77 | 1418 | 17
-TA -lv -RT | 31 | 652 | 2
-TA -sp | 76 | 1418 | 16
-TA -sp -RT | 30 | 652 | 1
-TA -lv -sp | 77 | 1418 | 17
-TA -lv -sp -RT | 31 | 652 | 2
-TA -DS | 76 | 1210 | 48
-TA -DS -RT | 30 | 508 | 10
-TA -DS -lv | 77 | 1418 | 17
-TA -DS -lv -RT | 31 | 652 | 2
-TA -DS -sp | 76 | 1418 | 16
-TA -DS -sp -RT | 30 | 652 | 1
-TA -DS -lv -sp | 77 | 1418 | 17
-TA -DS -lv -sp -RT | 31 | 652 | 2
-x -TA -DS -in | 76 | 1308 | 17
-x -TA -DS -in -RT | 26 | 500 | 2
in: ((Gp2)U(F(1)))&(p1 R(p2 R p0))
-TGTA | 17 | 124 | XXX
-TGTA -RT | 6 | 30 | XXX
-TA | 16 | 95 | 16
-TA -RT | 6 | 29 | 6
-TA -lv | 17 | 103 | 14
-TA -lv -RT | 8 | 42 | 6
-TA -sp | 16 | 103 | 13
-TA -sp -RT | 7 | 42 | 5
-TA -lv -sp | 17 | 103 | 14
-TA -lv -sp -RT | 8 | 42 | 6
-TA -DS | 16 | 95 | 16
-TA -DS -RT | 6 | 29 | 6
-TA -DS -lv | 16 | 95 | 16
-TA -DS -lv -RT | 6 | 29 | 6
-TA -DS -sp | 16 | 95 | 16
-TA -DS -sp -RT | 6 | 29 | 6
-TA -DS -lv -sp | 16 | 95 | 16
-TA -DS -lv -sp -RT | 6 | 29 | 6
-x -TA -DS -in | 16 | 92 | 16
-x -TA -DS -in -RT | 6 | 26 | 6
in: a U (b U c)
-TGTA | 22 | 196 | XXX
-TGTA -RT | 6 | 59 | XXX
-TA | 21 | 144 | 16
-TA -RT | 9 | 62 | 5
-TA -lv | 22 | 164 | 9
-TA -lv -RT | 11 | 85 | 2
-TA -sp | 21 | 164 | 8
-TA -sp -RT | 10 | 85 | 1
-TA -lv -sp | 22 | 164 | 9
-TA -lv -sp -RT | 11 | 85 | 2
-TA -DS | 21 | 144 | 16
-TA -DS -RT | 10 | 69 | 6
-TA -DS -lv | 22 | 164 | 9
-TA -DS -lv -RT | 11 | 85 | 2
-TA -DS -sp | 21 | 164 | 8
-TA -DS -sp -RT | 10 | 85 | 1
-TA -DS -lv -sp | 22 | 164 | 9
-TA -DS -lv -sp -RT | 11 | 85 | 2
-x -TA -DS -in | 22 | 164 | 9
-x -TA -DS -in -RT | 11 | 85 | 2
in: !(Ga U b)
-TGTA | 11 | 50 | XXX
-TGTA -RT | 5 | 23 | XXX
-TA | 10 | 31 | 8
-TA -RT | 4 | 13 | 3
-TA -lv | 11 | 37 | 6
-TA -lv -RT | 6 | 20 | 3
-TA -sp | 10 | 37 | 5
-TA -sp -RT | 5 | 20 | 2
-TA -lv -sp | 11 | 37 | 6
-TA -lv -sp -RT | 6 | 20 | 3
-TA -DS | 10 | 31 | 8
-TA -DS -RT | 5 | 16 | 4
-TA -DS -lv | 11 | 37 | 7
-TA -DS -lv -RT | 6 | 20 | 4
-TA -DS -sp | 10 | 37 | 6
-TA -DS -sp -RT | 5 | 20 | 3
-TA -DS -lv -sp | 11 | 37 | 7
-TA -DS -lv -sp -RT | 6 | 20 | 4
-x -TA -DS -in | 11 | 37 | 7
-x -TA -DS -in -RT | 6 | 20 | 4
in: # Make sure '(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
in: # has 21 states and 96 transitions before minimization, and
in: # has 20 states and 89 transitions, after minimization.
in: (G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))
-TGTA | 21 | 127 | XXX
-TGTA -RT | 17 | 93 | XXX
-TA | 20 | 92 | 12
-TA -RT | 15 | 57 | 9
-TA -lv | 21 | 104 | 6
-TA -lv -RT | 17 | 75 | 4
-TA -sp | 20 | 100 | 5
-TA -sp -RT | 16 | 70 | 3
-TA -lv -sp | 21 | 104 | 6
-TA -lv -sp -RT | 17 | 75 | 4
-TA -DS | 20 | 92 | 13
-TA -DS -RT | 18 | 81 | 12
-TA -DS -lv | 21 | 104 | 7
-TA -DS -lv -RT | 20 | 99 | 7
-TA -DS -sp | 20 | 100 | 6
-TA -DS -sp -RT | 19 | 95 | 6
-TA -DS -lv -sp | 21 | 104 | 7
-TA -DS -lv -sp -RT | 20 | 99 | 7
-x -TA -DS -in | 19 | 66 | 5
-x -TA -DS -in -RT | 15 | 52 | 5
in: GFa & GFb & GFc & GFd & GFe & GFg
-TGTA | 65 | 4160 | XXX
-TGTA -RT | 65 | 4160 | XXX
-TA | 64 | 4032 | 1
-TA -RT | 64 | 4032 | 1
-TA -lv | 64 | 4032 | 1
-TA -lv -RT | 64 | 4032 | 1
-TA -sp | 64 | 4032 | 1
-TA -sp -RT | 64 | 4032 | 1
-TA -lv -sp | 64 | 4032 | 1
-TA -lv -sp -RT | 64 | 4032 | 1
-TA -DS | 448 | 52416 | 70
-TA -DS -RT | 448 | 52416 | 70
-TA -DS -lv | 448 | 52416 | 70
-TA -DS -lv -RT | 448 | 52416 | 70
-TA -DS -sp | 448 | 52416 | 70
-TA -DS -sp -RT | 448 | 52416 | 70
-TA -DS -lv -sp | 448 | 52416 | 70
-TA -DS -lv -sp -RT | 448 | 52416 | 70
-x -TA -DS -in | 449 | 28608 | 65
-x -TA -DS -in -RT | 320 | 20352 | 65
in: Gq|Gr|(G(q|FGp)&G(r|FG!p))
-TGTA | 65 | 842 | XXX
-TGTA -RT | 21 | 294 | XXX
-TA | 64 | 740 | 26
-TA -RT | 22 | 264 | 14
-TA -lv | 65 | 776 | 15
-TA -lv -RT | 23 | 288 | 7
-TA -sp | 64 | 764 | 14
-TA -sp -RT | 22 | 280 | 6
-TA -lv -sp | 65 | 776 | 15
-TA -lv -sp -RT | 23 | 288 | 7
-TA -DS | 64 | 740 | 34
-TA -DS -RT | 26 | 366 | 20
-TA -DS -lv | 65 | 776 | 25
-TA -DS -lv -RT | 27 | 396 | 13
-TA -DS -sp | 64 | 764 | 24
-TA -DS -sp -RT | 26 | 386 | 12
-TA -DS -lv -sp | 65 | 776 | 25
-TA -DS -lv -sp -RT | 27 | 396 | 13
-x -TA -DS -in | 33 | 152 | 19
-x -TA -DS -in -RT | 21 | 112 | 11
in: FG((WaitRight4 M (HasRight1 W GWaitLeft0)) M HasLeft4)
-TGTA | 45 | 730 | XXX
-TGTA -RT | 35 | 598 | XXX
-TA | 44 | 602 | 16
-TA -RT | 33 | 482 | 9
-TA -lv | 45 | 676 | 9
-TA -lv -RT | 35 | 566 | 4
-TA -sp | 44 | 667 | 8
-TA -sp -RT | 34 | 545 | 3
-TA -lv -sp | 45 | 676 | 9
-TA -lv -sp -RT | 35 | 566 | 4
-TA -DS | 54 | 722 | 26
-TA -DS -RT | 42 | 600 | 19
-TA -DS -lv | 55 | 800 | 19
-TA -DS -lv -RT | 44 | 694 | 13
-TA -DS -sp | 54 | 795 | 18
-TA -DS -sp -RT | 43 | 683 | 12
-TA -DS -lv -sp | 55 | 800 | 19
-TA -DS -lv -sp -RT | 44 | 694 | 13
-x -TA -DS -in | 55 | 700 | 11
-x -TA -DS -in -RT | 39 | 566 | 8
in: G(F(GWaitLeft7 U Idle4) U (WaitLeft2 M IsEating2))
-TGTA | 69 | 1539 | XXX
-TGTA -RT | 49 | 935 | XXX
-TA | 68 | 1443 | 16
-TA -RT | 56 | 1179 | 15
-TA -lv | 68 | 1443 | 16
-TA -lv -RT | 56 | 1179 | 15
-TA -sp | 68 | 1443 | 16
-TA -sp -RT | 56 | 1179 | 15
-TA -lv -sp | 68 | 1443 | 16
-TA -lv -sp -RT | 56 | 1179 | 15
-TA -DS | 124 | 2964 | 44
-TA -DS -RT | 100 | 2285 | 42
-TA -DS -lv | 125 | 3028 | 42
-TA -DS -lv -RT | 101 | 2339 | 40
-TA -DS -sp | 124 | 3012 | 41
-TA -DS -sp -RT | 100 | 2324 | 39
-TA -DS -lv -sp | 125 | 3028 | 42
-TA -DS -lv -sp -RT | 101 | 2339 | 40
-x -TA -DS -in | 125 | 1838 | 25
-x -TA -DS -in -RT | 89 | 1344 | 25
EOF
sed -n 's/in: \(.*\)/\1/p' checkta.txt > input.txt
run 0 ../checkta input.txt | tee output.txt
diff checkta.txt output.txt

28
src/tests/ltl2ta2.test Executable file
View file

@ -0,0 +1,28 @@
#!/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
# This used to trigger an assert because of BA simulation not
# returning an instance of spot::sba.
run 0 ../../bin/ltl2tgta --ta 'G(F(a U b) U (c M d))'

1748
src/tests/ltl2tgba.cc Normal file

File diff suppressed because it is too large Load diff

221
src/tests/ltl2tgba.test Executable file
View file

@ -0,0 +1,221 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire
# de Recherche et Développement de l'Epita (LRDE).
# 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 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
cat >check.txt <<\EOF
a
a U b
X a
a & b & c
a | b | (c U (d & (g U (h ^ i))))
Xa & (b U !a) & (b U !a)
Fa & Xb & GFc & Gd
Fa & Xa & GFc & Gc
Fc & X(a | Xb) & GF(a | Xb) & Gc
a R (b R c)
(a U b) U (c U d)
((Xp2)U(X(1)))&(p1 R(p2 R p0))
{a*;c}<>->GFb
{((a*;b;c)*)&((b*;a;c)*)}<>->x
{(g;y;r)*}<>->x
G({(g;y;r)*}<>->x)
G({(a;b)*}<>->x)&G({(c;d)*}<>->y)
# try sub-braces
G({{a;b}*}[]->x)&G({{c;d}*}[]->y)
{([*0] + a):c*:([*0] + b)}<>->d
{a;e;f:(g*);h}<>->d
{(a:b)* & (c*:d)}<>->e
{(a:b)*}
G{(a:b)*}
{a;b}
{(a;b)*}
G{(a;b)*}
{a*}[]->{b*}
{a*}[]=>{b*}
{a*&b}
{a*&b*}
{((!c;b*) & d);e}
{(a* & (c;b*) & d);e}
{[*2];a[*2..4]}|->b
{a[*2..5] && b[*..3]}|->c
{{[+];a;[+]} && {[+];b;[+]}}<>->c
{(a[->3]) & {[+];b}}<>->c
# This formula (built by a random formula generator), exhibited an
# infinite recursion in the translation:
{(a|[*0])[*];1}
# Example from "Beyond Hardware Verification" by Glazberg, Moulin, Orni,
# Ruah, Zarpas (2007).
{[*];req;ack}|=>{start;busy[*];done}
# Examples from "Property-by-Example Guide: a Handbook of PSL Examples"
# by Ben David and Orni (2005)/
# - 2.27.A
{end[=3]}(false)
# - 3.5.A
{[*]; {read[=3]} && {write[=2]}} |=> {(!read && !write)[*]; ready}
# - 2.33 (abridged to fit in 80 cols)
{[*];st&&comp_d_en;!comp_d_en&&good_c;{st_v[->]}&&{stop[=0];true}}|->{!d_out}
# Some tricky cases that require the rational automaton to be pruned
# before it is used in the translation.
{{b[*];c} | {{a && !a}}[=2]}
{((a&!b);((!a&!b)*))&&(!b*;(!a&b))}
# When translating this formula, we expect the translator to ignore
# `a;(f&!f)[=2];c' on one side because it as already seen it on the
# other side.
{c;a;(f&!f)[=2];c}|{b;a;(!f&f)[=2];c}
# these were mis-translated in Spot 0.9
G!{(b;1)*;a}
(G!{(b;1)*;a} && ({1;1[*3]*}[]->{(b&!a)[*2];!b&!a}))
EOF
run 0 ../checkpsl check.txt
# Make sure False has one acceptance set when generating Büchi automata
test 1 -eq `../../bin/ltl2tgba -B false --stats %a`
# In particular, Spot 0.9 would incorrectly reject the sequence:
# (a̅b;a̅b;a̅b̅);(a̅b;a̅b;a̅b̅);(a̅b;a̅b;a̅b̅);... in 'G!{(b;1)*;a}'
# This means the following automaton was incorrectly empty in Spot 0.9.
run 0 ../ltl2tgba -e -R3 '(G!{(b;1)*;a} && ({1;1[*3]*}[]->{(b&!a)[*2];!b&!a}))'
# Make sure 'a U (b U c)' has 3 states and 6 transitions,
# before and after degeneralization.
for opt in '' -DT -DS; do
../ltl2tgba -ks -f -R3 $opt 'a U (b U c)' > stdout
grep 'transitions: 6$' stdout
grep 'states: 3$' stdout
done
# Make sure '!(Ga U b)' has 3 states and 6 transitions,
# before and after degeneralization.
for opt in '' -DT -DS; do
../ltl2tgba -kt -f -R3 $opt '!(Ga U b)' > stdout
grep 'sub trans.: 11$' stdout
grep 'transitions: 6$' stdout
grep 'states: 3$' stdout
done
# Make sure 'Ga U b' has 4 states and 6 transitions,
# before and after degeneralization.
for opt in '' -DT -DS; do
../ltl2tgba -kt -f -R3 $opt 'Ga U b' > stdout
grep 'sub trans.: 12$' stdout
grep 'transitions: 6$' stdout
grep 'states: 4$' stdout
done
# Make sure '(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
# has 6 states and 15 transitions, before and after degeneralization.
f='(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
for opt in '' -DT -DS; do
../ltl2tgba -ks -f -R3 $opt "$f" > stdout
grep 'transitions: 15$' stdout
grep 'states: 6$' stdout
../ltl2tgba -ks -f -R3f $opt "$f" > stdout
grep 'transitions: 15$' stdout
grep 'states: 6$' stdout
done
# Make sure 'GFa & GFb & GFc & GFd & GFe & GFf'
# has 7 states and 34 transitions after degeneralization.
f='GFa & GFb & GFc & GFd & GFe & GFg'
../ltl2tgba -ks -DS -x -f "$f" > stdout
grep 'transitions: 34$' stdout
grep 'states: 7$' stdout
# Make sure 'Ga & XXXX!a' is minimized to one state.
f='Ga & XXXX!a'
../ltl2tgba -ks -f "$f" > stdout
grep 'transitions: 4$' stdout
grep 'states: 5$' stdout
../ltl2tgba -ks -Rm -f "$f" > stdout
grep 'transitions: 0$' stdout
grep 'states: 1$' stdout
# Make sure a monitor for F(a & F(b)) accepts everything.
run 0 ../ltl2tgba -M -f "F(a & F(b))" | grep ' ->' > stdout
cat >expected <<EOF
I -> 0
0 -> 0 [label="1"]
EOF
cmp stdout expected
# This formula caused a segfault with Spot 0.7.
run 0 ../ltl2tgba -Rm -ks -f "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
grep 'transitions: 5$' stdout
grep 'states: 3$' stdout
# Adding -R3 used to make it work...
run 0 ../ltl2tgba -R3 -Rm -ks -f "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
grep 'transitions: 5$' stdout
grep 'states: 3$' stdout
# Make sure FGa|GFb has the same number of states/transitions when
# output as a never claim or are a degeneralized BA in HOAF.
# The option -R1q -R1t used to cause two degeneralizations to
# occur.
run 0 ../ltl2tgba -R1q -R1t -N 'FGa|FGb' > out.never
run 0 ../ltl2tgba -XN -kt out.never > count.never
run 0 ../ltl2tgba -R1q -R1t -DS -H 'FGa|FGb' > out.hoa
run 0 ../ltl2tgba -XH -kt out.hoa > count.hoa
cmp count.never count.hoa
# The following automaton should have only 4 states.
run 0 ../ltl2tgba -R3 -ks -f '(p&XF!p)|(!p&XFp)|X(Fp&F!p)' >stdout
grep 'transitions: 7$' stdout
grep 'states: 4$' stdout
# A bug in the translation of !{xxx} when xxx reduces to false caused
# the following formula to be considered equivalent to anything...
../../bin/ltlfilt -f '!{[*2] && [*0..1]}' --equivalent-to 'false' && exit 1
../../bin/ltlfilt -f '!{[*2] && [*0..1]}' --equivalent-to 'true'
# Test some equivalences fixed in Spot 1.1.4
../../bin/ltlfilt -f '{{a;b}[*]}' --equivalent-to 'a & Xb'
../../bin/ltlfilt -r -f '{{a;b}[*]}' --equivalent-to 'a & Xb'
../../bin/ltlfilt -f '!{{a;b}[*]}' --equivalent-to '!a | X!b'
../../bin/ltlfilt -r -f '!{{a;b}[*]}' --equivalent-to '!a | X!b'
../../bin/ltlfilt -f '{a[*];b[*]}' --equivalent-to 'a | b'
../../bin/ltlfilt -r -f '{a[*];b[*]}' --equivalent-to 'a | b'
# A couple of tests for the [:*i..j] operator
../../bin/ltlfilt -q -f '{{a;b}[:*1..2];c}' \
--equivalent-to '(a&X(b&Xc)) | a&(X(b&a&X(b&Xc)))'
../../bin/ltlfilt -q -r -f '{{a;b}[:*1..2];c}' \
--equivalent-to '(a&X(b&Xc)) | a&(X(b&a&X(b&Xc)))'
../../bin/ltlfilt -q -f '{{a*}[:+];c}' --equivalent-to 'Xc R a'
../../bin/ltlfilt -q -r -f '{{a*}[:+];c}' --equivalent-to 'Xc R a'
../../bin/ltlfilt -q -f '{c && {b | [*0]}[:+]}' --equivalent-to 'c & b'
../../bin/ltlfilt -q -r -f '{c && {b | [*0]}[:+]}' --equivalent-to 'c & b'
# test unknown dot options
../../bin/ltl2tgba --dot=@ a 2>stderr && exit 1
grep 'ltl2tgba: unknown option.*@' stderr

60
src/tests/ltlcounter.test Executable file
View file

@ -0,0 +1,60 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2014 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
pwd
lc="../../bin/genltl"
run='run 0'
check_formula()
{
# First, check the satisfiability of the formula with Spot
$run ../ltl2tgba -CR -e -x -f "$1" >/dev/null
# Also check the satisfiability of the degeneralized formula
$run ../ltl2tgba -CR -e -DT -x -f "$1" >/dev/null
$run ../ltl2tgba -CR -e -DS -x -f "$1" >/dev/null
}
# Kristin Y. Rozier reported that the formulae with n=10 were badly
# translated. Each of these formulae should have exactly one
# accepting path, but in this case the emptiness returned an automata
# without cycle. It turned out the function used to compare LTL
# formulae was bugged when two LTL formulae had the same hash value,
# so the translation of the formula stopped midway, on a formula it
# thought it had already seen.
check_range()
{
"$lc" --rv-counter $1 --rv-counter-linear $1 \
--rv-counter-carry $1 --rv-counter-carry-linear $1 |
while read line; do
check_formula "$line"
done
}
check_range 1..2
# Do not run the larger formulae with valgrind, it is too slow
run=
check_range 3..11

60
src/tests/ltlcross.test Executable file
View file

@ -0,0 +1,60 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2013, 2014 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
ltl2tgba=../ltl2tgba
(
# Some formulas supplied by Joachim Klein. The first two were
# incorrectly translated by ltl_to_tgba_fm(), while the other have
# shown some bugs in other translators.
cat <<EOF
G(Fa & ((a M b) U ((c U !d) M d)))
XF(p2 R (!Fp1 W p1))
X p0 || ((X p0) V <>p0)
p0 xor (p0 W X!p0)
p0 & (!p0 W Xp0)
EOF
# Random formulas
../../bin/randltl -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15
) |
../../bin/ltlcross --products=2 \
"$ltl2tgba -t -f %f > %T" \
"$ltl2tgba -t -f -y %f > %T" \
"$ltl2tgba -t -f -r4 %f > %T" \
"$ltl2tgba -t -f -R3 %f > %T" \
"$ltl2tgba -t -f -R3 -Rm %f > %T" \
"$ltl2tgba -t -f -R3 -RM %f > %T" \
"$ltl2tgba -t -f -DT %f > %T" \
"$ltl2tgba -t -f -DS %f > %T" \
"$ltl2tgba -t -f -r4 -R3 -RDS %f > %T" \
"$ltl2tgba -t -f -r4 -R3 -RRS %f > %T" \
"$ltl2tgba -t -f -r4 -R3 -RIS %f > %T" \
"$ltl2tgba -t -f -r4 -R3 -RDS -DS %f > %T" \
"$ltl2tgba -t -f -x -p %f > %T" \
"$ltl2tgba -t -f -x -p -L %f > %T" \
"$ltl2tgba -t -f -x -p -DT %f > %T" \
"$ltl2tgba -t -f -x -p -L -DT %f > %T" \
"$ltl2tgba -t -taa -r4 %f > %T" \
"$ltl2tgba -t -taa -r4 -c %f > %T" \
"$ltl2tgba -t -taa -r4 -R3 -RDS %f > %T"

46
src/tests/ltlcross2.test Executable file
View file

@ -0,0 +1,46 @@
#!/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
ltl2tgba=../../bin/ltl2tgba
../../bin/randltl -P -n 100 p1 p2 p3 p4 p5 p6 --tree-size 5..15 --seed=314 |
../../bin/ltlcross --products=3 --timeout=60 \
"$ltl2tgba --lbtt --any --low %f > %T" \
"$ltl2tgba --lbtt --any --medium %f > %T" \
"$ltl2tgba --hoa --any --high %f > %H" \
"$ltl2tgba --lbtt --deterministic --low %f > %T" \
"$ltl2tgba --lbtt --deterministic --medium %f > %T" \
"$ltl2tgba --lbtt --deterministic --high %f > %T" \
"$ltl2tgba --lbtt --small --low %f > %T" \
"$ltl2tgba --hoa --small --medium %f > %H" \
"$ltl2tgba --lbtt --small --high %f > %T" \
"$ltl2tgba --lbtt -x comp-susp --small %f >%T" \
"$ltl2tgba --lbtt -x comp-susp,!skel-wdba --small %f >%T" \
"$ltl2tgba --lbtt -x comp-susp,early-susp --small %f >%T" \
"$ltl2tgba --lbtt -x comp-susp,!skel-wdba,!skel-simul --small %f >%T" \
"$ltl2tgba --spin --ba -x degen-skip=0 %f >%N" \
"$ltl2tgba --lbtt --ba --high %f > %T" \
"$ltl2tgba --spin=6 --ba --medium %f > %N" \
"$ltl2tgba --hoa -BDC %f > %H" \
"$ltl2tgba --lbtt -BC %f > %T" \
--json=output.json --csv=output.csv

164
src/tests/ltlcross3.test Executable file
View file

@ -0,0 +1,164 @@
#!/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
check_csv()
{
# Make sure all lines in $1 have the same number of comas
sed 's/[^,]//g' < "$1" |
( read first
while read l; do
test "x$first" = "x$l" || exit 1
done)
}
ltl2tgba=../../bin/ltl2tgba
run 2 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'foo bar' 2>stderr -f a
grep 'ltlcross.*no input.*in.*foo bar' stderr
# Make sure non-zero exit codes are reported...
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv 2>stderr
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 2
check_csv out.csv
# ... unless --omit-missing is supplied.
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv --omit-missing 2>stderr
grep '"exit_status"' out.csv && exit 1
grep '"exit_code"' out.csv && exit 1
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 0
check_csv out.csv
# Likewise for timeouts
echo foo >bug
run 0 ../../bin/ltlcross 'sleep 5; false %f >%N' 'false %f >%N' \
--timeout 2 -f a --csv=out.csv \
--ignore-execution-failures \
--save-bogus=bug 2>stderr
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'warning:.*timeout' stderr | wc -l` -eq 2
test `grep 'warning:.*exit code 1' stderr | wc -l` -eq 2
test `grep '"timeout",-1' out.csv | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 2
grep '2 timeouts and 2 non-zero exit statuses, but no other problem' stderr
check_csv out.csv
# 'bug' should exist but be empty
test -f bug
test -s bug && exit 1
run 0 ../../bin/ltlcross 'sleep 5; false %f >%N' \
--timeout 2 --omit-missing -f a --csv=out.csv 2>stderr
grep '"exit_status"' out.csv && exit 1
grep '"exit_code"' out.csv && exit 1
test `grep 'warning:.*timeout' stderr | wc -l` -eq 2
test `wc -l < out.csv` -eq 1
check_csv out.csv
# Check with --products=5
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv --products=5 2>stderr
p=`sed 's/[^,]//g;q' out.csv | wc -c`
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 2
check_csv out.csv
# ... unless --omit-missing is supplied.
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv --omit-missing --products=5 2>stderr
grep '"exit_status"' out.csv && exit 1
grep '"exit_code"' out.csv && exit 1
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 0
check_csv out.csv
# Check with --products=+5
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv --products=+5 2>stderr
q=`sed 's/[^,]//g;q' out.csv | wc -c`
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 2
check_csv out.csv
# ... unless --omit-missing is supplied.
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%N' \
-f a --csv=out.csv --omit-missing --products=+5 2>stderr
grep '"exit_status"' out.csv && exit 1
grep '"exit_code"' out.csv && exit 1
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 0
check_csv out.csv
test $q -eq `expr $p + 12`
# Check with Rabin/Streett output
first="should not be erased"
echo "$first" > bug.txt
run 1 ../../bin/ltlcross "$ltl2tgba -s %f >%N" 'false %f >%D' \
-f 'X a' --csv=out.csv --save-bogus='>>bug.txt' 2>stderr
q=`sed 's/[^,]//g;q' out.csv | wc -c`
test $q -eq `expr $p + 6`
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*returned exit code 1' stderr | wc -l` -eq 2
test `grep '"exit code",1' out.csv | wc -l` -eq 2
check_csv out.csv
grep 'X a' bug.txt
test "`head -n 1 bug.txt`" = "$first"
# Support for --ABORT-- in HOA.
run 1 ../../bin/ltlcross 'echo HOA: --ABORT-- %f > %H' \
-f a --csv=out.csv 2>stderr
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*aborted' stderr | wc -l` -eq 2
test `grep '"aborted",-1' out.csv | wc -l` -eq 2
test 3 = `wc -l < out.csv`
check_csv out.csv
# The header of CSV file is not output in append mode
run 1 ../../bin/ltlcross 'echo HOA: --ABORT-- %f > %H' \
-f a --csv='>>out.csv' 2>stderr
grep '"exit_status"' out.csv
grep '"exit_code"' out.csv
test `grep 'error:.*aborted' stderr | wc -l` -eq 2
test `grep '"aborted",-1' out.csv | wc -l` -eq 4
test 5 = `wc -l < out.csv`
check_csv out.csv
# Diagnose empty automata
run 1 ../../bin/ltlcross ': %f >%O' -f a 2>stderr
test 2 = `grep -c 'error: empty output.' stderr`

88
src/tests/ltlcross4.test Executable file
View file

@ -0,0 +1,88 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2013, 2014 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
test -z "$PYTHON" && exit 77
ltl2tgba=../../bin/ltl2tgba
cat >formulas.txt <<EOF
GFa & GFb
GFa -> GFb
EOF
../../bin/ltlcross -F formulas.txt \
"{ltl2tgba any} $ltl2tgba --lbtt --any %f > %T" \
"{ltl2tgba det} $ltl2tgba --lbtt --deterministic %f > %T" \
"{ltl2tgba sma} $ltl2tgba --lbtt --small %f > %T" \
--csv=output.csv
cat >test.py <<EOF
import sys
try:
import pandas
except ImportError:
sys.exit(77)
x = pandas.read_csv("output.csv")
print(x.filter(('formula', 'tool',
'states', 'transitions')).groupby('tool').describe())
EOF
# will exit 77 if panda is not installed
$PYTHON test.py >out.1
# remove trailing whitespace from pandas' output,
# and limit to 26 lines, because Pandas 0.13 adds
# the size of the dataframe afterwards.
sed 's/[ \t]*$//g;26q' <out.1 > py.out
cat >expected <<EOF
states transitions
tool
ltl2tgba any count 4.000000 4.000000
mean 2.250000 10.000000
std 0.957427 5.163978
min 1.000000 4.000000
25% 1.750000 7.000000
50% 2.500000 10.000000
75% 3.000000 13.000000
max 3.000000 16.000000
ltl2tgba det count 4.000000 4.000000
mean 2.250000 9.250000
std 0.957427 4.573474
min 1.000000 4.000000
25% 1.750000 6.250000
50% 2.500000 9.500000
75% 3.000000 12.500000
max 3.000000 14.000000
ltl2tgba sma count 4.000000 4.000000
mean 2.250000 9.250000
std 0.957427 4.573474
min 1.000000 4.000000
25% 1.750000 6.250000
50% 2.500000 9.500000
75% 3.000000 12.500000
max 3.000000 14.000000
EOF
diff py.out expected

96
src/tests/ltlcrossce.test Executable file
View file

@ -0,0 +1,96 @@
#!/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 <http://www.gnu.org/licenses/>.
. ./defs
set -e
ltl2tgba=../../bin/ltl2tgba
# The following "fake" script behaves as
# version 1.5.9 of modella, when run as
# 'modella -r12 -g -e %L %T' on
# 'G(F(p0) & F(G(!p1))) | (F(G(!p0)) & G(F(p1)))'
# or its negation. The translation is bogus
# because the automata generated for this formula
# and its negation both include the language of G(!p0).
cat >fake <<\EOF
#!/bin/sh
case $1 in
"| G & F p0 F G ! p1 & F G ! p0 G F p1")
cat <<\END
7 1 0 1 -1 1 t
2 | & ! p0 ! p1 & ! p0 p1
3 t
4 | & ! p0 ! p1 & p0 ! p1
-1 1 0 -1 1 t
5 | & ! p0 ! p1 & ! p0 p1
-1 2 0 -1 5 | & ! p0 ! p1 & ! p0 p1
-1 3 0 1 -1 3 t
-1 4 0 1 -1 4 | & ! p0 ! p1 & p0 ! p1
-1 5 0 -1 5 & ! p0 ! p1
6 & ! p0 p1
-1 6 0 1 -1 2 | & ! p0 ! p1 & ! p0 p1
-1
END
;;
"! | G & F p0 F G ! p1 & F G ! p0 G F p1")
cat <<\END
12 1 0 1 -1 1 t
2 | & ! p0 ! p1 & p0 ! p1
3 t
4 t
5 | & ! p0 ! p1 & ! p0 p1
6 & ! p0 ! p1
-1 1 0 -1 1 t
2 | & ! p0 ! p1 & p0 ! p1
8 | & ! p0 ! p1 & ! p0 p1
6 & ! p0 ! p1
-1 2 0 -1 2 | & ! p0 ! p1 & p0 ! p1
6 & ! p0 ! p1
-1 3 0 -1 3 t
7 t
-1 4 0 -1 7 t
-1 5 0 -1 8 | & ! p0 ! p1 & ! p0 p1
6 & ! p0 ! p1
-1 6 0 1 -1 6 & ! p0 ! p1
-1 7 0 -1 7 | & ! p0 ! p1 & ! p0 p1
9 | & p0 ! p1 & p0 p1
-1 8 0 -1 10 | & ! p0 ! p1 & ! p0 p1
6 & ! p0 ! p1
-1 9 0 -1 11 t
-1 10 0 -1 10 | & ! p0 ! p1 & ! p0 p1
6 & ! p0 ! p1
-1 11 0 1 -1 4 t
-1
END
;;
esac
EOF
chmod +x fake
run 1 ../../bin/ltlcross -f 'G(F(p0) & F(G(!p1))) | (F(G(!p0)) & G(F(p1)))' \
"$ltl2tgba --lbtt %f >%T" "./fake %l >%T" 2> errors
cat errors
grep 'error: P0\*N1 is nonempty' errors
grep 'error: P1\*N0 is nonempty' errors
grep 'error: P1\*N1 is nonempty' errors
test `grep cycle errors | wc -l` = 3
test `grep '^error:' errors | wc -l` = 4

72
src/tests/ltlcrossce2.test Executable file
View file

@ -0,0 +1,72 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
ltl2tgba=../../bin/ltl2tgba
cat >fake <<\EOF
#!/bin/sh
case $1 in
"U G e p0 F p1 p2")
# echo 'U G e p0 F p1 p2' | ltl2dstar --output-format=hoa - - | fmt
cat <<\END
HOA: v1 States: 14 properties: implicit-labels trans-labels
no-univ-branch deterministic complete acc-name: Rabin 3 Acceptance: 6
(Fin(0)&Inf(1))|(Fin(2)&Inf(3))|(Fin(4)&Inf(5)) Start: 10 AP: 3 "p0"
"p1" "p2" --BODY-- State: 0 {5} 0 3 5 5 0 3 5 5 State: 1 {3 4} 0 12 5
1 0 12 5 1 State: 2 {3 4} 2 13 5 5 2 13 5 5 State: 3 {3 4} 13 13 5 5 13
13 5 5 State: 4 {1 2 4} 4 4 4 4 4 4 4 4 State: 5 {0 2 4} 5 5 5 5 5 5 5
5 State: 6 {2 4} 8 6 5 1 8 6 5 1 State: 7 {2 4} 7 8 5 5 2 8 5 5 State:
8 {2 4} 8 8 5 5 8 8 5 5 State: 9 {2 4} 7 11 5 9 2 6 5 1 State: 10 {2 4}
7 11 5 9 4 4 4 4 State: 11 {2 4} 8 11 5 9 8 6 5 1 State: 12 {4} 13 12
5 1 13 12 5 1 State: 13 {4} 13 13 5 5 13 13 5 5 --END--
END
;;
"! U G e p0 F p1 p2")
# echo '! U G e p0 F p1 p2' | ltl2dstar --output-format=hoa - - | fmt |
# sed '$s:8 13:13 8 /*<-bug*/:';
cat <<\END
HOA: v1 States: 14 properties: implicit-labels trans-labels
no-univ-branch deterministic complete acc-name: Rabin 3 Acceptance: 6
(Fin(0)&Inf(1))|(Fin(2)&Inf(3))|(Fin(4)&Inf(5)) Start: 11 AP: 3 "p0" "p1"
"p2" --BODY-- State: 0 {5} 4 0 8 8 4 0 8 8 State: 1 {3 4} 1 1 8 8 1 1 8
8 State: 2 {3 4} 1 2 8 13 1 2 8 13 State: 3 {3 4} 5 3 8 8 4 0 8 8 State:
4 {1 2 4} 1 1 8 8 1 1 8 8 State: 5 {1 2 4} 5 3 8 8 1 1 8 8 State: 6 {1
2 4} 6 3 8 8 12 1 8 8 State: 7 {1 2 4} 5 7 8 9 1 2 8 13 State: 8 {1 2 4}
8 8 8 8 8 8 8 8 State: 9 {1 2 4} 6 7 8 9 12 2 8 13 State: 10 {0 2 4} 10
10 10 10 10 10 10 10 State: 11 {2 4} 6 7 8 9 10 10 10 10 State: 12 {2 4}
12 1 8 8 12 1 8 8 State: 13 {2 4} 12 2 13 8 /*<-bug*/ 12 2 8 13 --END--
END
;;
esac
EOF
chmod +x fake
run 1 ../../bin/ltlcross -f 'G(a <-> Fb) U c' \
"$ltl2tgba --lbtt %f >%T" "./fake %l >%T" 2> errors
cat errors
grep 'error: P0\*N1 is nonempty' errors
grep 'error: P1\*N1 is nonempty' errors
grep 'error: Comp..1.\*Comp..1. is nonempty' errors
test `grep cycle errors | wc -l` = 3
test `grep '^error:' errors | wc -l` = 4

112
src/tests/ltldo.test Executable file
View file

@ -0,0 +1,112 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
ltldo=../../bin/ltldo
ltl2tgba=../../bin/ltl2tgba
genltl=../../bin/genltl
run 0 $ltldo -f a -f 'a&b' -t 'echo %f,%s' >output
cat >expected <<EOF
(a),(a)
(a) & (b),(a) && (b)
EOF
diff output expected
# Renaming
run 0 $ltldo -f a -f 'a&_b' -t 'echo %f,%s' >output
cat >expected <<EOF
(a),(a)
(p0) & (p1),(p0) && (p1)
EOF
diff output expected
# Test timeouts. This test should take 2*2 seconds.
$genltl --or-g=1..2 |
run 0 $ltldo -F- -t 'sleep 10; echo %f' -T1 -t 'sleep 10; echo %f' \
>output 2>stderr
test -z "`cat output`"
test 4 = `grep -c warning: stderr`
$genltl --and-gf=1..3 |
run 0 $ltldo "{tgba}$ltl2tgba %f -H >%H" "{ba}$ltl2tgba >%N %f -s" \
--stats="%T,%R,%f,%s,%t,%e" >output
cat output
cat >expected <<EOF
tgba,1,GFp1,1,2,2
ba,1,GFp1,2,4,4
tgba,2,GFp1 & GFp2,1,4,4
ba,2,GFp1 & GFp2,3,12,8
tgba,3,GFp1 & GFp2 & GFp3,1,8,8
ba,3,GFp1 & GFp2 & GFp3,4,32,13
EOF
diff output expected
# Renaming
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H >output
cat output
# The HOA output uses _foo_ as atomic proposition, but the name shows
# that GFp0 was actually given to ltl2tgba.
cat >expected <<EOF
HOA: v1
name: "GFp0"
States: 1
Start: 0
AP: 1 "_foo_"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected
# But we can force the name in the output:
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H --name=%f >output
cat output
cat >expected <<EOF
HOA: v1
name: "GF_foo_"
States: 1
Start: 0
AP: 1 "_foo_"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected
$ltldo ': %s; true>%O' -f GFa 2>stderr && exit 1
test $? = 2
grep 'error: command ".*" produced an empty output.' stderr
grep 'ltldo: aborting' stderr

31
src/tests/ltldo2.test Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
ltldo=../../bin/ltldo
genltl=../../bin/genltl
test -n "$LTL2BA" || exit 77
$genltl --or-g=1..2 |
run 0 $ltldo 'ltl2ba -f %s>%H' '{foo}ltl2ba' >output
test 4 = `grep -c digraph output`

76
src/tests/ltlprod.cc Normal file
View file

@ -0,0 +1,76 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// 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 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/>.
#include <iostream>
#include <cassert>
#include <cstdlib>
#include "ltlast/allnodes.hh"
#include "ltlparse/public.hh"
#include "twaalgos/product.hh"
#include "twaalgos/ltl2tgba_fm.hh"
#include "twaalgos/dotty.hh"
void
syntax(char* prog)
{
std::cerr << prog << " formula1 formula2" << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
if (argc != 3)
syntax(argv[0]);
{
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::parse_error_list pel1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], pel1, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::ltl::parse_error_list pel2;
const spot::ltl::formula* f2 = spot::ltl::parse(argv[2], pel2, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], pel2))
return 2;
auto dict = spot::make_bdd_dict();
{
auto a1 = spot::ltl_to_tgba_fm(f1, dict);
auto a2 = spot::ltl_to_tgba_fm(f2, dict);
f1->destroy();
f2->destroy();
spot::dotty_reachable(std::cout, product(a1, a2));
}
}
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
return exit_code;
}

39
src/tests/ltlprod.test Executable file
View file

@ -0,0 +1,39 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2015 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# 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 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
# We don't check the output, but just running these might be enough to
# trigger assertions.
run 0 ../ltlprod a b
run 0 ../ltlprod a a
run 0 ../ltlprod 'a U b' 'X f'
run 0 ../ltlprod 'X a' 'X a'
run 0 ../ltlprod 'X a' 'a U b'
run 0 ../ltlprod 'a & b & c' 'b & d & c'
run 0 ../ltlprod 'a | b | (c U (d & (g U (h ^ i))))' 'h ^ i'
run 0 ../ltlprod 'Xa & (b U !a) & (b U !a)' '(b U !a) & f'

159
src/tests/maskacc.test Executable file
View file

@ -0,0 +1,159 @@
#!/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
cat >input1 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(0)&Fin(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {1}
State: 1
[0] 2
[0] 3 {1}
State: 2
[1] 1
[1] 3 {0}
State: 3
[0] 3 {0 1}
--END--
EOF
cat >expect1 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[1] 1 {0}
State: 1
[1] 2
State: 2
[0] 1
[0] 3 {0}
State: 3
--END--
EOF
run 0 ../../bin/autfilt --mask-acc=0 input1 -H >output
diff output expect1
cat >expect2 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 1 Fin(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
State: 1
[0] 2
State: 2
[1] 1
[1] 3 {0}
State: 3
--END--
EOF
run 0 ../../bin/autfilt --mask-acc=1 input1 -H >output
diff output expect2
cat >expect3 <<EOF
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
--END--
EOF
run 0 ../../bin/autfilt --mask-acc=0,1,2 input1 -H >output
diff output expect3
run 0 ../../bin/autfilt --mask-acc=0 --mask-acc=1 input1 -H >output
diff output expect3
cat >input4 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 3 Inf(1)|Fin(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {1}
[1] 2 {0}
State: 1
[0] 2
[0] 3 {0}
State: 2
[1] 1
[1] 3 {1}
State: 3
[0] 3 {0 1}
--END--
EOF
cat >expect4 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[1] 1 {0}
State: 1
[1] 2
State: 2
[0] 1
[0] 3 {0}
State: 3
--END--
EOF
run 0 ../../bin/autfilt --mask-acc=1 input4 -H >output
diff output expect4
# Errors
run 2 ../../bin/autfilt --mask-acc=a3 input1
run 2 ../../bin/autfilt --mask-acc=3-2 input1
run 2 ../../bin/autfilt --mask-acc=0,9999,1 input1

113
src/tests/maskkeep.test Executable file
View file

@ -0,0 +1,113 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
cat >input1 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {1}
State: 1
[0] 2
[0] 3 {1}
State: 2
[1] 1
[1] 3 {0}
State: 3
[0] 3 {0 1}
--END--
EOF
cat >expect1 <<EOF
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
--END--
EOF
run 0 ../../bin/autfilt --keep-states=0 input1 -H >output
diff output expect1
run 0 ../../bin/autfilt --keep-states=1 input1 -H >output
diff output expect1
cat >expect3 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {1}
State: 1
[0] 2
State: 2
[1] 1
--END--
EOF
cat >expect4 <<EOF
HOA: v1
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0] 1
State: 1
[1] 0
--END--
EOF
run 0 ../../bin/autfilt --keep-states=0,1,2 input1 -H >output
diff output expect3
run 0 ../../bin/autfilt --keep-states=0,9999,1,2 input1 -H >output
diff output expect3
run 0 ../../bin/autfilt --keep-states=1,2,0 input1 -H >output
diff output expect4
# Errors
run 2 ../../bin/autfilt --keep-states=a3 input1
run 2 ../../bin/autfilt --keep-states=3-2 input1

78
src/tests/monitor.test Executable file
View file

@ -0,0 +1,78 @@
#!/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
expect()
{
cat >output.exp
run 0 "$@" > output.out
cat output.out
diff output.out output.exp
}
expect ../../bin/ltl2tgba --monitor a <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 1
0 [label="0"]
0 -> 0 [label="1"]
1 [label="1"]
1 -> 0 [label="a"]
}
EOF
expect ../../bin/ltl2tgba --monitor a --hoa<<EOF
HOA: v1
name: "a"
States: 2
Start: 1
AP: 1 "a"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
properties: stutter-invariant inherently-weak
--BODY--
State: 0
[t] 0
State: 1
[0] 0
--END--
EOF
expect ../../bin/ltl2tgba --monitor GFa --hoa<<EOF
HOA: v1
name: "GFa"
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0
[t] 0
--END--
EOF

401
src/tests/neverclaimread.test Executable file
View file

@ -0,0 +1,401 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 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
cat >input <<EOF
never {
T2_init:
if
:: (1) -> goto T2_init
:: (p1 && p0) -> goto T1
fi;
T1:
T1b: /* alias */
if
:: (p1 && (! p0)) -> goto alias2
:: !(p1) -> goto T1b
:: ! (p1) -> goto T2_init
fi;
alias1:
accept_all:
alias2:
skip
}
EOF
run 0 ../ltl2tgba -XN -H input > stdout
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "p0" "p1"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[t] 0
[0&1] 1
State: 1
[!1] 0
[!1] 1
[!0&1] 2
State: 2 {0}
[t] 2
--END--
EOF
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input stdout expected
# Same test, but with the newer syntax output since Spin 6.24
cat >input <<EOF
never {
T2_init:
do
:: (1) -> goto T2_init
:: (p1 && p0) -> goto T1
od;
T1:
do
:: atomic { (p1 && (! p0)) -> assert(!(p1 && (! p0))) }
:: !(p1) -> goto T1
:: ! (p1) -> goto T2_init
od;
}
EOF
run 0 ../ltl2tgba -XN -H input > stdout
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "p0" "p1"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[t] 0
[0&1] 1
State: 1
[!1] 0
[!1] 1
[!0&1] 2
State: 2 {0}
[t] 2
--END--
EOF
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input stdout expected
# Unparenthesed disjunction
cat >input <<EOF
never { /* p0 || p1 */
accept_init:
if
:: (p1) && (p0) -> goto accept_all
:: (p1) && !(p0) -> goto accept_all
fi;
accept_all:
skip
}
EOF
run 0 ../ltl2tgba -XN input > stdout
cat >expected <<EOF
digraph G {
rankdir=LR
I [label="", style=invis, width=0]
I -> 0
0 [label="0", peripheries=2]
0 -> 1 [label="p1"]
1 [label="1", peripheries=2]
1 -> 1 [label="1"]
}
EOF
diff stdout expected
rm input stdout expected
# Test broken guards in input
cat >input <<EOF
never {
T2_init:
if
:: (1) -> goto T2_init
:: (p1 && ) -> goto T1
fi;
T1:
if
:: (p1 && ! p0)) -> goto accept_all
:: (p1) -> goto T1
fi;
accept_all:
skip
}
EOF
# We used to catch the following error:
# input:5.11: syntax error, unexpected closing parenthesis
# input:5.8-9: missing right operand for "and operator"
# but since the guard parser is more lenient, we just assume
# that "p1 && " is an atomic property.
run 2 ../ltl2tgba -XN input > stdout 2>stderr
cat >expected <<\EOF
input:9.16: syntax error, unexpected ')', expecting fi or ':'
EOF
grep input: stderr > stderrfilt
diff stderrfilt expected
# This output from MoDeLLa was not property parsed by Spot because of
# the missing parentheses around p0. Report from František Blahoudek.
cat >input <<EOF
never{
T0_init:
if
:: true -> goto T1
:: p0 -> goto T2
fi;
T1:
if
:: true -> goto T1
:: p0 -> goto accept_T3
fi;
T2:
if
:: p0 -> goto accept_T3
fi;
accept_T3:
if
:: p0 -> goto T2
fi;
}
EOF
cat >expected<<EOF
transitions: 6
states: 4
EOF
run 0 ../ltl2tgba -ks -XN input > output
diff output expected
# Test duplicated labels. The following neverclaim was produced by
# ltl2ba 1.1 for '[](<>[]p1 U X[]<>Xp0)', but is rejected by Spin
# because of a duplicate label (accept_S10). We should
# complain as well. This was reported by Joachim Klein.
cat >input <<\EOF
never { /* [](<>[]p1 U X[]<>Xp0) */
T0_init:
if
:: (1) -> goto accept_S2
:: (1) -> goto T1_S3
:: (p1) -> goto T2_S4
fi;
accept_S2:
if
:: (1) -> goto accept_S39
:: (1) -> goto T1_S24
:: (p1) -> goto accept_S10
fi;
accept_S39:
if
:: (p0) -> goto accept_S39
:: (1) -> goto T0_S39
:: (1) -> goto T0_S24
:: (p1) -> goto T0_S10
fi;
T0_S39:
if
:: (p0) -> goto accept_S39
:: (1) -> goto T0_S39
:: (1) -> goto T0_S24
:: (p1) -> goto T0_S10
fi;
T0_S24:
if
:: (1) -> goto T0_S24
:: (p1) -> goto T0_S10
fi;
T0_S10:
if
:: (p0 && p1) -> goto accept_S10
:: (p1) -> goto T0_S10
fi;
accept_S10:
if
:: (p0 && p1) -> goto accept_S10
:: (p1) -> goto T0_S10
fi;
T1_S24:
if
:: (1) -> goto T1_S24
:: (p1) -> goto accept_S10
fi;
accept_S10:
if
:: (p1) -> goto accept_S10
fi;
T1_S3:
if
:: (1) -> goto T1_S3
:: (1) -> goto T1_S24
:: (p1) -> goto T2_S4
:: (p1) -> goto accept_S10
fi;
T2_S4:
if
:: (p1) -> goto T2_S4
:: (p1) -> goto accept_S10
fi;
}
EOF
run 2 ../ltl2tgba -ks -XN input > stdout 2>stderr
cat stderr
cat >expected-err <<\EOF
input:48.1-10: redefinition of accept_S10...
input:38.1-10: ... accept_S10 previously defined here
EOF
grep input: stderr > stderrfilt
diff stderrfilt expected-err
# DOS-style new lines should have the same output.
perl -pi -e 's/$/\r/' input
run 2 ../ltl2tgba -ks -XN input > stdout 2>stderr
cat stderr
grep input: stderr > stderrfilt
diff stderrfilt expected-err
# Empty guards should be diagnosed at the correct location
cat >input <<EOF
never { /* a U b */
T0_init:
if
:: ((b)) -> goto accept_all
:: ( ) -> goto T0_init
fi;
accept_all:
skip
}
never { /* a U b */
T0_init:
if
:: ((b)) -> goto accept_all
:: ((b) -> goto T0_init
fi;
accept_all:
skip
}
EOF
../../bin/autfilt --name=%F --dot=nsc <input >stdout 2>stderr && exit 1
cat >expected <<EOF
digraph G {
rankdir=LR
label="-"
labelloc="t"
node [shape="circle"]
I [label="", style=invis, width=0]
I -> 0
subgraph cluster_0 {
color=green
label=""
1 [label="1", peripheries=2]
}
subgraph cluster_1 {
color=red
label=""
0 [label="0"]
}
0 -> 1 [label="b"]
0 -> 0 [label="0"]
1 -> 1 [label="1"]
}
EOF
diff stdout expected
# FIXME: the "ignoring trailing garbage" is unwanted
cat >expected.err <<EOF
5.6-8: unexpected empty block
5.6-8: ignoring trailing garbage
14.6-19.1: missing closing parenthese
19.1: syntax error, unexpected end of file, expecting fi or ':'
autfilt: failed to read automaton from -
EOF
diff stderr expected.err
cat >formulae<<EOF
a
FG a
X false
(G a) U X b
(a U b) U (c U d)
true
(Ga && XXXX!a)
"a > b" U "process@foo"
GF("(a + b) == 42" U "process@foo")
EOF
while read f
do
run 0 ../../bin/ltl2tgba -H "!($f)" > f.hoa
run 0 ../../bin/ltl2tgba -s -f "$f" > f.spot
# Make sure there is no `!x' occurring in the
# output. Because `x' is usually #define'd, we
# should use `!(x)' in guards.
grep '![^(].*->' f.spot && exit 1
# In case we cannot run spin or ltl2ba, use the spot output
cp f.spot f.spin
cp f.spot f.ltl2ba
sf=`../../bin/ltlfilt -sf "$f"`
if test -n "$SPIN"; then
# Old spin versions cannot parse formulas such as ((a + b) == 42).
$SPIN -f "$sf" > f.spin.tmp && mv f.spin.tmp f.spin
fi
case $f in
*\"*);;
*)
if test -n "$LTL2BA"; then
$LTL2BA -f "$sf" > f.ltl2ba
fi
esac
run 0 ../../bin/autfilt --count -v --intersect=f.hoa \
f.spot f.spin f.ltl2ba >out
test 3 = `cat out`
done <formulae

75
src/tests/nondet.test Executable file
View file

@ -0,0 +1,75 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 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 <http://www.gnu.org/licenses/>.
. ./defs
set -e
cat >expected.1<<EOF
FGa, 0 0
GFa, 1 1
a U b, 1 0
G(!r | Fa) | Fx, 0 1
EOF
# also test the filename/COL syntax
run 0 ../../bin/ltl2tgba -F expected.1/1 --stats='%f, %d %p' >out.1
diff out.1 expected.1
cat >expected.2<<EOF
FGa, 0 1
GFa, 1 1
a U b, 1 1
G(!r | Fa) | Fx, 0 1
EOF
# filename/COL should also work when filename=-
run 0 ../../bin/ltl2tgba -C -F-/1 --stats='%f, %d %p' <expected.2 >out.2
diff out.2 expected.2
# Test multi-line CSV fields.
cat >in.2b<<EOF
FGa, 0 1
GFa, 1 1
a U b, 1 1
"G(!r | Fa)
|
Fx", 0 1
EOF
run 0 ../../bin/ltl2tgba -C -Fin.2b/1 --stats='%f, %d %p' >out.2b
diff out.2b expected.2
run 0 ../../bin/ltl2tgba FGa GFa --stats='%f %d %n %s %p' >out.3
cat >expected.3<<EOF
FGa 0 1 2 0
GFa 1 0 1 1
EOF
diff out.3 expected.3
run 0 ../../bin/ltl2tgba -DC FGa GFa --stats='%f %d %n %s %p' >out.4
cat >expected.4<<EOF
FGa 0 1 3 1
GFa 1 0 1 1
EOF
diff out.4 expected.4

120
src/tests/obligation.test Executable file
View file

@ -0,0 +1,120 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 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 +x
set -e
cat >formulas.txt <<EOF
SA G(!p)
SA Fr->(!p U r)
SA G(q->G(!p))
SA G((q&!r&Fr)->(!p U r))
SA G(q&!r->((!p U r)|G!p ))
SA (!r U (p&!r))|(G!r)
SA G(q&!r->((!r U (p&!r))|G!r))
SA (!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p
SA Fr->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r)))))))))
SA Fq->(!q U (q&((!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p)))
SA G((q&Fr)->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r))))))))))
SA G(q->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|((!p U r)|G!p)|Gp)))))))))
SA G(p)
SA Fr->(p U r)
SA G(q->G(p))
SA G((p&!r&Fr)->(p U r))
SA G(q&!r->((p U r)|Gp))
SA Fr->(!p U (s|r))
SA G((q&!r&Fr)->(!p U (s|r)))
SA G(q&!r->((!p U (s|r))|G!p))
SA Fr->(p->(!r U (s&!r))) U r
SA G((q&!r&Fr)->(p->(!r U (s&!r))) U r)
SA Fp->(!p U (s&!p&X(!p U t)))
SA Fr->(!p U (r|(s&!p&X(!p U t))))
SA (G!q)|(!q U (q&Fp->(!p U (s&!p&X(!p U t)))))
SA G((q&Fr)->(!p U (r|(s&!p&X(!p U t)))))
SA G(q->(Fp->(!p U (r|(s&!p&X(!p U t))))))
SA (F(s&XFt))->((!s) U p)
SA Fr->((!(s&(!r)&X(!r U (t&!r))))U(r|p))
SA (G!q)|((!q)U(q&((F(s&XFt))->((!s) U p))))
SA G((q&Fr)->((!(s&(!r)&X(!r U (t&!r))))U(r|p)))
SA Fr->(p->(!r U (s&!r&X(!r U t)))) U r
SA G((q&Fr)->(p->(!r U (s&!r&X(!r U t)))) U r)
SA Fr->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r
SA G((q&Fr)->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r)
GU Fp
OB G(!q)|F(q&Fp)
OB (!p U s)|Gp
SA G(q->(!(s&(!r)&X(!r U (t&!r)))U(r|p)|G(!(s&XFt))))
OB Fr->(s&X(!r U t)->X(!r U (t&Fp))) U r
NO G(q&!r->(!r U (p&!r)))
NO G!q|F(q&((!p U s)|G!p))
NO G(p->Fs)
NO G(q->G(p->Fs))
NO G(q&!r->(((p->(!r U (s&!r))) U r)|G(p->(!r U (s&!r)))))
NO G(s&XFt->X(F(t&Fp)))
NO G(q->G(s&XFt->X(!t U (t&Fp))))
NO G((q&Fr)->(s&X(!r U t)->X(!r U (t&Fp))) U r)
NO G(q->(s&X(!r U t)->X(!r U (t&Fp)))U(r|G(s&X(!r U t)->X(!r U (t&Fp)))))
NO G(p->F(s&XFt))
NO G(q->G(p->(s&XFt)))
NO G(q->(p->(!r U (s&!r&X(!r U t))))U(r|G(p->(s&XFt))))
NO G(p->F(s&!z&X(!z U t)))
NO G(q->G(p->(s&!z&X(!z U t))))
NO G(q->(p->(!r U (s&!r&!z&X((!r&!z) U t))))U(r|G(p->(s&!z&X(!z U t)))))
GS p
GS q&Xp
GS G(Ga&F!a)
EOF
grok()
{
case $1 in
"this is a safety property"*) echo SA;;
"this is a guarantee property"*) echo GU;;
"this is a guarantee and a safety"*) echo GS;;
"this is an obligation property"*) echo OB;;
"this is not an obligation property"*) echo NO;;
*) echo XX;;
esac
}
success=:
while read exp f; do
x=`../ltl2tgba -O "$f"`
y=`../ltl2tgba -O "!($f)"`
resx=`grok "$x"`
resy=`grok "$y"`
echo "$resx $f"
if test "$resx" != "$exp"; then
echo "Expected $exp, got $resx"; exit 1
fi
echo "$resy !($f)"
case $resx,$resy in
SA,GU);;
GU,SA);;
GS,GS);;
OB,OB);;
NO,NO);;
*) echo "Incompatible results: $resx,$resy"; exit 1;;
esac
done < formulas.txt
exit 0

100
src/tests/randaut.test Executable file
View file

@ -0,0 +1,100 @@
#!/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-30"
name: "0-1-10-4-27"
name: "0-2-10-6-20"
name: "0-3-10-1-25"
name: "0-4-10-2-20"
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
$randaut -n 2 -S5 -A4 -H 2 | grep Acceptance: > output
$randaut --acc-type=random -n 2 -S5 -A4 -H 2 | grep Acceptance: >> output
cat output
cat >expected <<EOF
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
Acceptance: 4 (Fin(2) & Inf(3)) | Inf(0) | Fin(1)
Acceptance: 4 ((Inf(0) | Inf(1)) & Fin(3)) | Inf(2)
EOF
diff output expected
$randaut --spin --acc-type=random 2 2>stderr && exit 1
grep 'randaut: --spin.*--acc-type' stderr
$randaut --ba --acc-type=random 2 2>stderr && exit 1
grep 'randaut: --ba.*--acc-type' stderr

137
src/tests/randomize.test Executable file
View file

@ -0,0 +1,137 @@
#!/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
ltl2tgba=../../bin/ltl2tgba
autfilt=../../bin/autfilt
$ltl2tgba --hoa 'Ga | Gb | Gc | Gd' > out
cat >expected <<EOF
HOA: v1
name: "Ga | Gb | Gc | Gd"
States: 5
Start: 0
AP: 4 "a" "b" "c" "d"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc stutter-invariant
properties: inherently-weak
--BODY--
State: 0
[0] 1
[1] 2
[2] 3
[3] 4
State: 1
[0] 1
State: 2
[1] 2
State: 3
[2] 3
State: 4
[3] 4
--END--
EOF
diff out expected
# The seed and formula where chosen so that these four outputs are
# different.
run 0 $autfilt --seed=1 --dot out > 1.dot
run 0 $autfilt --seed=1 --dot --randomize=t out > 2.dot
run 0 $autfilt --seed=1 --dot --randomize=s out > 3.dot
run 0 $autfilt --seed=1 --dot --randomize=st out > 4.dot
cmp 1.dot 2.dot && exit 1
cmp 1.dot 3.dot && exit 1
cmp 2.dot 3.dot && exit 1
cmp 2.dot 4.dot && exit 1
cmp 3.dot 4.dot && exit 1
# A second run should produce the same output
$autfilt --seed=1 --dot out > 1b.dot
$autfilt --seed=1 --dot --randomize=t out > 2b.dot
$autfilt --seed=1 --dot --randomize=s out > 3b.dot
$autfilt --seed=1 --dot --randomize=st out > 4b.dot
diff 1.dot 1b.dot
diff 2.dot 2b.dot
diff 3.dot 3b.dot
diff 4.dot 4b.dot
$autfilt --randomize=foo out 2>stderr && exit 1
grep "unknown argument for --randomize: 'f'" stderr
# Make sure names are moved.
cat >input <<EOF
HOA: v1
States: 5
Start: 4
AP: 4 "a" "b" "c" "d"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 "s1"
[0] 0
State: 1 "s3"
[2] 1
State: 2 "s2"
[1] 2
State: 3 "s4"
[3] 3
State: 4 "s0"
[3] 3
[2] 1
[0] 0
[1] 2
--END--
EOF
$autfilt --randomize --seed=1 input -H > output
cat >expected <<EOF
HOA: v1
States: 5
Start: 3
AP: 4 "a" "b" "c" "d"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 "s4"
[3] 0
State: 1 "s2"
[1] 1
State: 2 "s1"
[0] 2
State: 3 "s0"
[1] 1
[3] 0
[2] 4
[0] 2
State: 4 "s3"
[2] 4
--END--
EOF
diff output expected

34
src/tests/randpsl.test Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 2012, 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
# Generate 50 random unique PSL formula that do not simplify to LTL
# formulae, and that have a size of at lease 12.
../../bin/randltl -n -1 --tree-size 30 --seed 12 --psl a b c |
../../bin/ltlfilt -r --size-min 12 --unique |
../../bin/ltlfilt -v --ltl -n 50 | tee formulas |
../../bin/ltlcross '../ltl2tgba -R3 -t %f >%T' '../ltl2tgba -x -R3 -t %f >%T' \
-F - -f '{{(p1)}[*]:{(p3) && {{!(p1)} xor {!(p3)}}}}'
test `wc -l < formulas` = 50

1310
src/tests/randtgba.cc Normal file

File diff suppressed because it is too large Load diff

33
src/tests/randtgba.test Executable file
View file

@ -0,0 +1,33 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2014, 2015 Laboratoire de Recherche et Development de
# l'EPITA.
#
# 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 n in 10 20 30 40 50 60 70 80 90 100 200 500 1000; do
# Make sure graph generated by randaut have successors for each
# of their $n nodes.
../../bin/randaut -S$n 3 -Hl |
sed 's/.*--BODY--//;s/State:/\n&/g;s/--END--//' > out
grep -q 'State: [0-9][0-9]* .*$' out
grep -q 'State: [0-9]* *$' out && exit 1
done
true

30
src/tests/readsat.cc Normal file
View file

@ -0,0 +1,30 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 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/>.
#include <iostream>
#include "misc/satsolver.hh"
int main()
{
spot::satsolver::solution sol = spot::satsolver_get_solution("-");
for (spot::satsolver::solution::const_iterator i = sol.begin();
i != sol.end(); ++i)
std::cout << ' ' << *i;
std::cout << '\n';
}

52
src/tests/readsat.test Executable file
View file

@ -0,0 +1,52 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 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/>.
# Do some quick translations to make sure the neverclaims produced by
# spot actually look correct! We do that by parsing them via ltlcross.
# ltl2neverclaim-lbtt.test does the same with LBTT if it is installed.
. ./defs
set -e
cat > foo <<EOF
c some comment
c more comment
v 12 13
cignore
vignore
v 14 -15
signore
v
EOF
test ' 12 13 14 -15' = "`../readsat < foo`"
cat > foo <<EOF
c some comment
c more comment
v12 13
cignore
vignore
v 14 0 -15
signore
v
EOF
test ' 14' = "`../readsat < foo`"

673
src/tests/readsave.test Executable file
View file

@ -0,0 +1,673 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012, 2014, 2015 Laboratoire de Recherche
# et Développement de l'Epita (LRDE).
# 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 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
autfilt=../../bin/autfilt
ltl2tgba=../../bin/ltl2tgba
randltl=../../bin/randltl
cat >input <<\EOF
HOA: v1
States: 3
Start: 0
AP: 3 "a" "b" "F\\G"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {0 1}
[0&!1] 1
State: 1 {0}
[2] 2
State: 2
[t] 0
--END--
EOF
run 0 $autfilt --hoa input > stdout
diff stdout input
# Transition merging
cat >input <<\EOF
HOA: v1
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0&1] 1 {0}
[!1] 1
[0&!1] 1 {0}
State: 1
[!1] 0
[1&0] 0 {0}
[0&!1] 0 {0}
--END--
EOF
cat >expected <<\EOF
HOA: v1
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[!1] 1
[0] 1 {0}
State: 1
[!1] 0
[0] 0 {0}
--END--
EOF
run 0 ../../bin/autfilt --merge-transitions --hoa input > stdout
cat stdout
run 0 ../../bin/autfilt -F stdout --isomorph expected
# Likewise, with a randomly generated TGBA.
run 0 ../../bin/randaut -S 20 a b -d 0.2 -a 0.2 -A 2 --hoa | tee input
# the first read-write can renumber the states
run 0 $autfilt --hoa --merge-transitions input > stdout
run 0 ../../bin/autfilt -F input --isomorph stdout
# But this second output should be the same as the first
run 0 $autfilt --hoa stdout > stdout2
diff stdout stdout2
# Find formula that can be translated into a 3-state automaton, and
# exercise both %M and %m. The nonexistant file should never be
# open, because the input stream is infinite and autfilt should
# stop after 10 automata.
$randltl -n -1 a b |
$ltl2tgba -H -F - |
$autfilt -F- -F nonexistant --states=3 --edges=..10 --acc-sets=1.. \
--name='%M, %S states' --stats='<%m>, %e, %a' -n 10 > output
cat >expected <<EOF
<F(b | Ga), 3 states>, 5, 1
<F(!b & G(!b | G!a)), 3 states>, 5, 1
<XF!b, 3 states>, 4, 1
<Gb | G!b, 3 states>, 4, 1
<XFb, 3 states>, 4, 1
<F(b W a), 3 states>, 6, 1
<(a & !b & (b | (!b M F!a))) | (!a & (b | (!b & (b W Ga)))), 3 states>, 5, 1
<(a & (a U !b)) | (!a & (!a R b)), 3 states>, 5, 1
<a | G((a & GFa) | (!a & FG!a)), 3 states>, 4, 1
<XXG(!a & (Fa W Gb)), 3 states>, 3, 1
EOF
diff output expected
cat >input <<EOF
HOA: v1
States: 10
Start: 0
AP: 1 "a"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {0}
[!0] 1 {0}
[!0] 2 {0}
[0] 3 {0}
[0] 3 {0 2}
[!0] 2 {0 2}
[!0] 4 {1}
[!0] 5 {1}
[!0] 6 {1}
[!0] 6 {1 2}
[!0] 7 {1}
[!0] 8 {1}
[!0] 9 {1}
[!0] 9 {1 2}
[!0] 4 {0 1}
[!0] 5 {0 1}
[!0] 6 {0 1}
[!0] 6 {0 1 2}
[!0] 7 {0 1}
[!0] 8 {0 1}
[!0] 9 {0 1}
[!0] 9 {0 1 2}
State: 1
[0] 3 {0 2}
State: 2
[!0] 2 {0 2}
[!0] 6 {1 2}
[!0] 9 {1 2}
[!0] 6 {0 1 2}
[!0] 9 {0 1 2}
State: 3
[!0] 1 {0 2}
[!0] 2 {0}
[0] 3 {0 2}
[!0] 2 {0 2}
[!0] 5 {1 2}
[!0] 6 {1}
[!0] 6 {1 2}
[!0] 8 {1 2}
[!0] 9 {1}
[!0] 9 {1 2}
[!0] 5 {0 1 2}
[!0] 6 {0 1}
[!0] 6 {0 1 2}
[!0] 8 {0 1 2}
[!0] 9 {0 1}
[!0] 9 {0 1 2}
State: 4
[!0] 4 {1}
[!0] 5 {1}
[!0] 6 {1}
[!0] 6 {1 2}
[!0] 7
[!0] 8
[!0] 9
[!0] 9 {2}
[!0] 7 {1}
[!0] 8 {1}
[!0] 9 {1}
[!0] 9 {1 2}
State: 5
State: 6
[!0] 6 {1 2}
[!0] 9 {2}
[!0] 9 {1 2}
State: 7
[0] 0 {0}
[0] 3 {0}
[0] 3 {0 2}
State: 8
[0] 3 {0 2}
State: 9
--END--
EOF
cat >expected <<EOF
HOA: v1
name: "63->32 edges, 64->33 transitions"
States: 10
Start: 0
AP: 1 "a"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels
--BODY--
State: 0
[t] 0 {0}
[!0] 1 {0}
[!0] 2 {0 2}
[0] 3 {0 2}
[!0] 4 {0 1}
[!0] 5 {0 1}
[!0] 6 {0 1 2}
[!0] 7 {0 1}
[!0] 8 {0 1}
[!0] 9 {0 1 2}
State: 1 {0 2}
[0] 3
State: 2
[!0] 2 {0 2}
[!0] 6 {0 1 2}
[!0] 9 {0 1 2}
State: 3
[!0] 1 {0 2}
[!0] 2 {0 2}
[0] 3 {0 2}
[!0] 5 {0 1 2}
[!0] 6 {0 1 2}
[!0] 8 {0 1 2}
[!0] 9 {0 1 2}
State: 4
[!0] 4 {1}
[!0] 5 {1}
[!0] 6 {1 2}
[!0] 7 {1}
[!0] 8 {1}
[!0] 9 {1 2}
State: 5
State: 6 {1 2}
[!0] 6
[!0] 9
State: 7
[0] 0 {0}
[0] 3 {0 2}
State: 8 {0 2}
[0] 3
State: 9
--END--
EOF
$autfilt --merge -Hm input --name="%E->%e edges, %T->%t transitions" > output
diff output expected
cat <<EOF | $ltl2tgba -x degen-skip=1 -F- --ba -H > tmp.hoa
a U b
false
!b && Xb && GFa
EOF
$autfilt <tmp.hoa --stats='"%M","%w"' > output
cat >expected <<EOF
"a U b","cycle{b}"
"0",""
"!b & X(b & GFa)","!b; cycle{a & b}"
EOF
diff output expected
cat >input <<EOF
HOA: v1
States: 4
Start: 2
Start: 3
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 "s0" {0}
[1] 0
State: 1 "s1" {0}
[0] 1
State: 2 "s2"
[1] 0
State: 3 "s3"
[0] 1
--END--
EOF
$autfilt -H input |
SPOT_DOTDEFAULT=vcsn SPOT_DOTEXTRA='/* hello world */' $autfilt >output
cat >expected <<EOF
digraph G {
node [shape="circle"]
/* hello world */
I [label="", style=invis, height=0]
I -> 3
subgraph cluster_0 {
color=green
1 [label="s1", peripheries=2]
}
subgraph cluster_1 {
color=green
0 [label="s0", peripheries=2]
}
subgraph cluster_2 {
color=black
3 [label="s3"]
}
0 -> 0 [label="b"]
1 -> 1 [label="a"]
2 [label="s2"]
2 -> 0 [label="b"]
3 -> 1 [label="a"]
3 -> 0 [label="b"]
}
EOF
diff output expected
test 1 = `$autfilt -H input --complete | $autfilt --is-complete --count`
$ltl2tgba --dot=a 'GFa & GFb' >output
cat output
cat >expected <<EOF
digraph G {
rankdir=LR
label="Inf(0)&Inf(1)"
labelloc="t"
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="a & b\n{0,1}"]
0 -> 0 [label="!a & !b"]
0 -> 0 [label="!a & b\n{1}"]
0 -> 0 [label="a & !b\n{0}"]
}
EOF
diff output expected
$ltl2tgba --dot=ban 'GFa & GFb' >output
cat output
cat >expected <<EOF
digraph G {
rankdir=LR
label="G(Fa & Fb)\nInf(⓿)&Inf(❶)"
labelloc="t"
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label="a & b\n⓿❶"]
0 -> 0 [label="!a & !b"]
0 -> 0 [label="!a & b\n❶"]
0 -> 0 [label="a & !b\n⓿"]
}
EOF
diff output expected
SPOT_DOTDEFAULT=bra $ltl2tgba --dot='c.f(Lato)' 'GFa & GFb' >output
cat output
zero='<font color="#5DA5DA">⓿</font>'
one='<font color="#F17CB0">❶</font>'
cat >expected <<EOF
digraph G {
rankdir=LR
label=<Inf($zero)&amp;Inf($one)>
labelloc="t"
node [shape="circle"]
fontname="Lato"
node [fontname="Lato"]
edge [fontname="Lato"]
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label=<a &amp; b<br/>$zero$one>]
0 -> 0 [label=<!a &amp; !b>]
0 -> 0 [label=<!a &amp; b<br/>$one>]
0 -> 0 [label=<a &amp; !b<br/>$zero>]
}
EOF
diff output expected
cat >in <<EOF
HOA: v1
States: 10
Start: 0
AP: 2 "a" "b"
Acceptance: 4 Fin(0) | (Fin(1) & Inf(2)) | Fin(3)
--BODY--
State: 0
[!0&!1] 1
[0&!1] 2
[!0&1] 3
[0&1] 4
State: 1 "test me" {0 3}
[!0&!1] 1
[0&!1] 2
[!0&1] 6
[0&1] 7
State: 2 {0 2 3}
[!0&!1] 1
[0&!1] 2
[!0&1] 6
[0&1] 7
State: 3 {3}
[t] 5
State: 4 "hihi" {2 3}
[t] 5
State: 5 {1 3}
[t] 5
State: 6 {0}
[!0&!1] 8
[!0&1] 6
[0&!1] 9
[0&1] 7
State: 7 {0 2}
[!0&!1] 8
[!0&1] 6
[0&!1] 9
[0&1] 7
State: 8 {0 3}
[!0&!1] 8
[!0&1] 6
[0&!1] 9
[0&1] 7
State: 9 {0 2 3}
[!0&!1] 8
[!0&1] 6
[0&!1] 9
[0&1] 7
--END--
EOF
cat >expected <<EOF
digraph G {
rankdir=LR
label="Fin(⓿) | (Fin(❶) & Inf(❷)) | Fin(❸)"
labelloc="t"
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 1 [label="!a & !b",taillabel="0"]
0 -> 2 [label="a & !b",taillabel="1"]
0 -> 3 [label="!a & b",taillabel="2"]
0 -> 4 [label="a & b",taillabel="3"]
1 [label="test me\n⓿❸"]
1 -> 1 [label="!a & !b",taillabel="0"]
1 -> 2 [label="a & !b",taillabel="1"]
1 -> 6 [label="!a & b",taillabel="2"]
1 -> 7 [label="a & b",taillabel="3"]
2 [label="2\n⓿❷❸"]
2 -> 1 [label="!a & !b",taillabel="0"]
2 -> 2 [label="a & !b",taillabel="1"]
2 -> 6 [label="!a & b",taillabel="2"]
2 -> 7 [label="a & b",taillabel="3"]
3 [label="3\n❸"]
3 -> 5 [label="1",taillabel="0"]
4 [label="hihi\n❷❸"]
4 -> 5 [label="1",taillabel="0"]
5 [label="5\n❶❸"]
5 -> 5 [label="1",taillabel="0"]
6 [label="6\n⓿"]
6 -> 8 [label="!a & !b",taillabel="0"]
6 -> 6 [label="!a & b",taillabel="1"]
6 -> 9 [label="a & !b",taillabel="2"]
6 -> 7 [label="a & b",taillabel="3"]
7 [label="7\n⓿❷"]
7 -> 8 [label="!a & !b",taillabel="0"]
7 -> 6 [label="!a & b",taillabel="1"]
7 -> 9 [label="a & !b",taillabel="2"]
7 -> 7 [label="a & b",taillabel="3"]
8 [label="8\n⓿❸"]
8 -> 8 [label="!a & !b",taillabel="0"]
8 -> 6 [label="!a & b",taillabel="1"]
8 -> 9 [label="a & !b",taillabel="2"]
8 -> 7 [label="a & b",taillabel="3"]
9 [label="9\n⓿❷❸"]
9 -> 8 [label="!a & !b",taillabel="0"]
9 -> 6 [label="!a & b",taillabel="1"]
9 -> 9 [label="a & !b",taillabel="2"]
9 -> 7 [label="a & b",taillabel="3"]
}
EOF
$autfilt --dot=bao in >out
diff out expected
# Let's pretend that this is some used supplied input, as discussed in
# the comments of https://github.com/adl/hoaf/issues/39
cat >input <<EOF
HOA: v1
States: 7
Start: 1
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 1
[!0&1] 0
[!0&!1] 4
State: 3
[!0&!1] 2
State: 4
[0&1] 6
[0&1] 5
[0&1] 2
[!0&1] 3
State: 6
[!0&!1] 1
[!0&!1] 3
[0&1] 7
--END--
EOF
# autfilt should complain about the input (we only check the exit
# status here, because the actual error messages are tested in
# hoaparse.test) and produce a valid output with the number of states
# fixed, and the missing state definitions.
$autfilt -H input >output1 && exit 1
cat >expect1 <<EOF
HOA: v1
States: 8
Start: 1
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
State: 1
[!0&1] 0
[!0&!1] 4
State: 2
State: 3
[!0&!1] 2
State: 4
[0&1] 6
[0&1] 5
[0&1] 2
[!0&1] 3
State: 5
State: 6
[!0&!1] 1
[!0&!1] 3
[0&1] 7
State: 7
--END--
EOF
diff output1 expect1
# Make sure the output is valid.
$autfilt -H output1 > output1b
diff output1 output1b
# Here is the scenario where the undefined states are actually states
# we wanted to remove. So we tell autfilt to fix the automaton using
# --remove-dead-states
$autfilt -H --remove-dead input >output2 && exit 1
cat >expect2 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[!0&!1] 1
State: 1
[0&1] 2
State: 2
[!0&!1] 0
--END--
EOF
diff output2 expect2
# Check the difference between --remove-unreach and --remove-dead
cat >input <<EOF
HOA: v1
States: 6
Start: 0
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
--BODY--
State: 0
[!0&!1] 1
State: 1
[0&1] 2
State: 2
[!0&!1] 0
[t] 5
State: 3
[t] 4
State: 4
[t] 3
State: 5
--END--
EOF
$autfilt -H --remove-unreach input >output3
$autfilt -H --remove-dead input >>output3
cat >expect3 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[!0&!1] 1
State: 1
[0&1] 2
State: 2
[!0&!1] 0
[t] 3
State: 3
--END--
HOA: v1
States: 3
Start: 0
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[!0&!1] 1
State: 1
[0&1] 2
State: 2
[!0&!1] 0
--END--
EOF
diff output3 expect3

470
src/tests/remfin.test Executable file
View file

@ -0,0 +1,470 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
autfilt=../../bin/autfilt
cat >test1 <<EOF
/*
** This was a TGBA for GFa & GFb, but
** the acceptance has been changed to Fin(0)|Fin(1)
** so this is now the complement automaton.
*/
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
Acceptance: 2 Fin(0)|Fin(1)
--BODY--
State: 0
[0&1] 0 {0 1}
[!0&!1] 0
[!0&1] 0 {1}
[0&!1] 0 {0}
--END--
/*
** This one has a mix of Inf and Fin acceptance, but no interference
** between the Fin sets
*/
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
Acceptance: 5 Inf(0)&Fin(1)&Fin(3) | Inf(2)&Inf(3) | Inf(4)
--BODY--
State: 0 {3 4}
[t] 0
[0] 1 {1}
[!0] 2 {0}
State: 1 {3}
[1] 0
[0&1] 1 {0}
[!0&1] 2 {2}
State: 2
[!1] 0
[0&!1] 1 {0}
[!0&!1] 2 {0}
--END--
/*
** This one is similar, but Inf(0) is used in two terms, so
** we need to introduce extra sets in the output.
*/
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 4 Inf(0)&Fin(1)&Fin(3) | Inf(2)&Inf(3) | Inf(0)
--BODY--
State: 0 {3}
[t] 0
[0] 1 {1}
[!0] 2 {0}
State: 1 {3}
[1] 0
[0&1] 1 {0}
[!0&1] 2 {2}
State: 2
[!1] 0
[0&!1] 1 {0}
[!0&!1] 2 {0}
--END--
/*
** The t and f acceptance.
*/
HOA: v1
States: 1
Start: 0
Acceptance: 0 f
--BODY--
State: 0
--END--
HOA: v1
States: 1
Start: 0
Acceptance: 0 t
--BODY--
State: 0
[t] 0
--END--
/* An example from ltl2dstar.
** No new state should be added.
*/
HOA: v1
States: 2
acc-name: Rabin 1
Acceptance: 2 (Fin(0)&Inf(1))
Start: 0
AP: 1 "p0"
--BODY--
State: 0 {}
0
1
State: 1 {1}
1
1
--END--
HOA: v1
States: 8
Start: 2
AP: 1 "p1"
Acceptance: 4 (Fin(3) & Inf(0)) | (Fin(1) & Fin(3)) |
(Fin(1) & Inf(2)) | (Inf(0)&Inf(2))
properties: trans-labels explicit-labels state-acc complete deterministic
--BODY--
State: 0
[!0] 6
[0] 0
State: 1 {2}
[!0] 3
[0] 3
State: 2 {2}
[!0] 5
[0] 1
State: 3 {2}
[!0] 6
[0] 0
State: 4 {2}
[!0] 6
[0] 4
State: 5 {2}
[!0] 7
[0] 3
State: 6 {1 2}
[!0] 6
[0] 0
State: 7 {3}
[!0] 6
[0] 4
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0&1] 0
[!0&!1] 0
[!0&1] 0
[0&!1] 0
[!0&!1] 1
[!0&1] 1
[!0&!1] 2
[0&!1] 2
State: 1 {0}
[!0&!1] 1
[!0&1] 1
State: 2 {0}
[!0&!1] 2
[0&!1] 2
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 4 Inf(0) | Inf(3) | (Inf(1)&Inf(2))
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {2 3}
[0] 1 {2 3}
[!0] 2 {2 3}
State: 1
[1] 0 {2}
[0&1] 1 {2}
[!0&1] 2 {1 2}
State: 2
[!1] 0
[0&!1] 1
[!0&!1] 2
[!0&!1] 3
State: 3
[!0&!1] 3 {0}
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 5 (Inf(0)&Inf(1)&Inf(4)) | Inf(0) | (Inf(2)&Inf(3))
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {3}
[0] 1 {3}
[!0] 2 {0 3}
State: 1
[1] 0 {3}
[0&1] 1 {0 3}
[!0&1] 2 {2 3}
State: 2
[!1] 0
[0&!1] 1 {0}
[!0&!1] 2 {0}
[!0&!1] 3 {0}
State: 3
[!0&!1] 3 {0 1 4}
--END--
HOA: v1
States: 1
Start: 0
AP: 0
Acceptance: 0 f
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
--END--
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[t] 0
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "p0"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[!0] 0
[0] 1
State: 1 {0}
[!0] 1
[0] 1
--END--
HOA: v1
States: 10
Start: 2
AP: 1 "p1"
Acceptance: 2 Inf(1) | Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[!0] 6
[0] 0
[0] 8
[0] 9
State: 1 {0 1}
[!0] 3
[0] 3
State: 2 {0 1}
[!0] 5
[0] 1
State: 3 {0 1}
[!0] 6
[0] 0
State: 4 {0 1}
[!0] 6
[0] 4
State: 5 {0 1}
[!0] 7
[0] 3
State: 6
[!0] 6
[0] 0
State: 7 {1}
[!0] 6
[0] 4
State: 8
[0] 8
State: 9 {1}
[0] 9
--END--
EOF
cat >expected-tgba <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0&1] 0
[!0&!1] 0
[!0&1] 0
[0&!1] 0
[!0&!1] 1
[!0&1] 1
[!0&!1] 2
[0&!1] 2
State: 1 {0}
[!0&!1] 1
[!0&1] 1
State: 2 {0}
[!0&!1] 2
[0&!1] 2
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {0 1}
[0] 1 {0 1}
[!0] 2 {0 1}
State: 1
[1] 0 {1}
[0&1] 1 {1}
[!0&1] 2 {0 1}
State: 2
[!1] 0
[0&!1] 1
[!0&!1] 2
[!0&!1] 3
State: 3
[!0&!1] 3 {0 1}
--END--
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[t] 0 {1}
[0] 1 {1}
[!0] 2 {0 1}
State: 1
[1] 0 {1}
[0&1] 1 {0 1}
[!0&1] 2 {0 1}
State: 2
[!1] 0
[0&!1] 1 {0 1}
[!0&!1] 2 {0 1}
[!0&!1] 3 {0 1}
State: 3
[!0&!1] 3 {0 1}
--END--
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
properties: stutter-invariant inherently-weak
--BODY--
State: 0
--END--
HOA: v1
States: 1
Start: 0
AP: 0
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[t] 0
--END--
HOA: v1
States: 2
Start: 0
AP: 1 "p0"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0
[!0] 0
[0] 1
State: 1 {0}
[!0] 1
[0] 1
--END--
HOA: v1
States: 10
Start: 2
AP: 1 "p1"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[!0] 6
[0] 0
[0] 8
[0] 9
State: 1 {0}
[!0] 3
[0] 3
State: 2 {0}
[!0] 5
[0] 1
State: 3 {0}
[!0] 6
[0] 0
State: 4 {0}
[!0] 6
[0] 4
State: 5 {0}
[!0] 7
[0] 3
State: 6
[!0] 6
[0] 0
State: 7 {0}
[!0] 6
[0] 4
State: 8
[0] 8
State: 9 {0}
[0] 9
--END--
EOF
run 0 $autfilt -H --remove-fin test1 > output
cat output
diff -u output expected
run 0 $autfilt -H --tgba test1 > output
cat output
diff -u output expected-tgba

97
src/tests/remprop.test Executable file
View file

@ -0,0 +1,97 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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 || exit 1
set -e
cat >automaton <<EOF
HOA: v1
States: 4
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
--BODY--
State: 0
[0] 1
State: 1
[1] 2
[2] 2
State: 2 {0}
[1] 2
[0&1] 1
[1&2] 3
State: 3
[t] 3
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 4
Start: 0
AP: 1 "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc complete
--BODY--
State: 0
[t] 1
State: 1
[t] 2
[0] 2
State: 2 {0}
[t] 2
[t] 1
[0] 3
State: 3
[t] 3
--END--
EOF
run 0 ../../bin/autfilt -H --remove-ap=a,b automaton >out
cat out
diff out expected
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[t] 1
State: 1
[0] 2
State: 2
--END--
EOF
run 0 ../../bin/autfilt -H --remove-ap=a=1,b=0 automaton >out
cat out
diff out expected
../../bin/autfilt -H --remove-ap=a==1 automaton 2>stderr && exit 1
grep "autfilt: unexpected '=' at position 2 in 'a==1'" stderr

74
src/tests/renault.test Executable file
View file

@ -0,0 +1,74 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 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
cat >file <<EOF
HOA: v1
States: 10
Start: 0
AP: 4 "a" "b" "c" "d"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[!0&!1&!2 | 0&2] 0 {0}
[0&1] 1
[!0&!1&!2 | 0&2] 2
[!0&!2] 3
[!0&!2] 4 {0}
[0&1] 5
State: 1
[0&2] 0 {0}
[0&1] 1
[0&2] 2
[0&1] 5
State: 2
[t] 6
State: 3
[!1&!2] 6
[!2] 7
State: 4
[!0&!1&!2] 0 {0}
[!0&!1&!2] 2
[!0&!2] 3
[!0&!2] 4 {0}
State: 5
[2] 6
[1] 8
State: 6
State: 7
State: 8
[1&!2&!3] 9
State: 9
[1&!2] 9
--END--
EOF
cat >outexp <<EOF
transitions: 12
states: 6
EOF
run 0 ../ltl2tgba -XH -ks -RDS file > out
cmp out outexp

97
src/tests/satmin.test Executable file
View file

@ -0,0 +1,97 @@
#!/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 <http://www.gnu.org/licenses/>.
. ./defs
set -e
# Skip if $SATSOLVE is not installed.
(${SATSOLVER-glucose} --help >/dev/null 2>&1) || exit 77
ltl2tgba=../../bin/ltl2tgba
ltlcross=../../bin/ltlcross
cat >formulas <<'EOF'
XXa
GF(a -> XXXb)
F(p & XF(q & XF(r & XFs)))
F(q & X(p U r))
F(p & X(q & XFr))
p U (q & X(r U s))
G(a -> Fb) & G(c -> Fd)
GFa & GFb
GFa | GFb | GFc
GFa
a U b U c U d
G(a -> Fb) & Gc
(Ga -> Fb) & (G!a -> F!b)
p U (q & X(r & F(s & XF(u & XF(v & XFw)))))
G(a -> Fb) & G(b -> Fc)
G(a -> Fb) & G(!a -> F!b)
GFp && GFq && GF r && GF u
GF(a <-> XXXb)
G(p -> q U r)
GF(a <-> XXb)
G!c & G(a -> Fb) & G(b -> Fc)
G(a -> XXXb)
G(a -> Fb)
G(a U b U !a U !b)
(p U q U r) || (q U r U p) || (r U p U q)
X((a M F((!c & !b) | (c & b))) W (G!c U b))
X(((a & b) R (!a U !c)) R b)
XXG(Fa U Xb)
(!a M !b) W F!c
(b & Fa & GFc) R a
(a R (b W a)) W G(!a M (c | b))
(Fa W b) R (Fc | !a)
X(G(!a M !b) | G(a | G!a))
Fa W Gb
Ga | GFb
G((G!a & ((!b & X!c) | (b & Xc))) | (Fa & ((!b & Xc) | (b & X!c))))
a M G(F!b | X!a)
G!a R XFb
XF(!a | GFb)
G(F!a U !a) U Xa
(a | G(a M !b)) W Fc
Fa W Xb
X(a R ((!b & F!c) M X!a))
XG!a R Fb
GFc | (a & Fb)
X(a R (Fb R F!b))
G(Xa M Fa)
X(Gb | GFa)
X(Gc | XG((b & Ga) | (!b & F!a)))
Ga R Fb
G(a U (b | X((!c & !a) | (a & c))))
XG((G!a & F!b) | (Fa & (a | Gb)))
(a U X!a) | XG(!b & XFc)
X(G!a | GFa)
G(G!a | F!c | G!b)
EOF
$ltlcross -F formulas \
--timeout=60 \
"$ltl2tgba --det --lbtt %f >%T" \
"$ltl2tgba --det --lbtt -x tba-det %f >%T" \
"$ltl2tgba --det --lbtt -x sat-acc=1 %f >%T" \
"$ltl2tgba --det --lbtt -x sat-acc=3 %f >%T" \
"$ltl2tgba --det --lbtt -x sat-states=3 %f >%T" \
"$ltl2tgba --det --lbtt -x sat-minimize %f >%T" \
"$ltl2tgba --det --lbtt -x sat-minimize=2 %f >%T" \
--json=det.json

65
src/tests/satmin2.test Executable file
View file

@ -0,0 +1,65 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 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
# Skip if $SATSOLVE is not installed.
(${SATSOLVER-glucose} --help >/dev/null 2>&1) || exit 77
# This is a counterexample for one of the optimization idea we had for
# the SAT-based minimization.
cat >input.hoa <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete deterministic
--BODY--
State: 0
[0] 1 {0}
[!0] 2
State: 1
[!0] 0 {0}
[0] 2
State: 2
[0] 2 {0}
[!0] 2
--END--
EOF
cat >expected <<EOF
sub trans.: 2
transitions: 2
states: 1
nondeterministic states: 0
EOF
../ltl2tgba -RS1 -kt -XH input.hoa > output
diff output expected
# At some point, this formula was correctly minimized, but
# the output was not marked as state-based.
../../bin/ltl2tgba -BD -x sat-minimize "GF(a <-> XXb)" -H >out
grep 'properties:.*state-acc' out
grep 'properties:.*deterministic' out

126
src/tests/sbacc.test Executable file
View file

@ -0,0 +1,126 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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 || exit 1
set -e
ltl2tgba=../../bin/ltl2tgba
autfilt=../../bin/autfilt
$ltl2tgba 'GFa & GFb' -H | run 0 $autfilt --sbacc -H > out.hoa
cat >expected<<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0 {0 1}
[0&1] 0
[!0&!1] 1
[!0&1] 2
[0&!1] 3
State: 1
[0&1] 0
[!0&!1] 1
[!0&1] 2
[0&!1] 3
State: 2 {1}
[0&1] 0
[!0&!1] 1
[!0&1] 2
[0&!1] 3
State: 3 {0}
[0&1] 0
[!0&!1] 1
[!0&1] 2
[0&!1] 3
--END--
EOF
diff out.hoa expected
# This procedure should be acceptance-agnostic.
cat >in.hoa<<EOF
HOA: v1
Start: 0
AP: 1 "a"
Acceptance: 2 Fin(0)|Inf(1)
--BODY--
State: 0
[0] 1
State: 1 {0}
[0] 2
State: 2
[0] 0 {1}
--END--
EOF
run 0 $autfilt --state-based-acceptance in.hoa -H > out.hoa
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "a"
Acceptance: 2 Fin(0) | Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {1}
[0] 1
State: 1
[0] 2
State: 2 {0}
[0] 0
--END--
EOF
diff out.hoa expected
$autfilt --sba -H expected > out.hoa
diff out.hoa expected
$autfilt --strip-acc -H expected > out.hoa
cat >expected <<EOF
HOA: v1
States: 3
Start: 0
AP: 1 "a"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[0] 1
State: 1
[0] 2
State: 2
[0] 0
--END--
EOF
diff out.hoa expected
../../bin/randltl --weak-fairness -n 20 2 |
../../bin/ltlcross "$ltl2tgba -DH %f >%O" "$ltl2tgba -H %f | $autfilt -H >%O"

35
src/tests/scc.test Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2015 Laboratoire de Recherche et Developpement de
# l'Epita
#
# 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
cat >formulas<<EOF
((a U c) U b) & (b U c),15,6,5
b U a,3,2,2
0,0,1,1
(Gb | F!a) W GFc,22,6,5
(!a & G(Ga | F(!a & b))) | (a & F(F!a & G(a | !b))),16,7,6
EOF
run 0 ../../bin/ltl2tgba --low --any --stats='%f,%e,%s,%c' -F formulas/1 >out
cat out
diff out formulas

149
src/tests/sccdot.test Executable file
View file

@ -0,0 +1,149 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Laboratoire de Recherche et Développement de
# l'Epita
#
# 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
# Check the scc_info categorization of SCCs as accepting/rejecting
# by looking at the dot output.
cat <<EOF > in.hoa
HOA: v1
States: 11
Start: 1
AP: 2 "a" "b"
acc-name: generalized-Buchi 2
Acceptance: 3 Inf(0)&Inf(1)&Fin(2)
--BODY--
State: 0 {2}
[0&1] 0 {0 1}
[!0&!1] 0
[0] 5
State: 1
[1] 4
[0&!1] 3
State: 4
[!1] 4 {1 2}
[1] 2
State: 2
[0] 0
[1] 7
State: 3
[0&1] 1 {1 0}
State: 5
[t] 6
State: 6
[t] 5
State: 7
[!0&1] 7 {0 1} /* This state and the next one differs by */
[0&1] 7 {0 2} /* the order of the self loops. */
[t] 8
State: 8
[!0&1] 8 {0 2}
[0&1] 8 {0 1}
[t] 9
State: 9
[!0&1] 9 {0 2}
[0&1] 10 {0 1}
State: 10
[!0&1] 9 {0 1}
[0&1] 10 {0 2}
--END--
EOF
run 0 ../../bin/autfilt --dot=as in.hoa > out.dot
# The important stuff is the color=xxx lines
cat <<EOF >expected
digraph G {
rankdir=LR
label="Fin(2) & (Inf(0)&Inf(1))"
labelloc="t"
I [label="", style=invis, width=0]
I -> 1
subgraph cluster_0 {
color=grey
label=""
5 [label="5"]
6 [label="6"]
}
subgraph cluster_1 {
color=orange
label=""
0 [label="0"]
}
subgraph cluster_2 {
color=orange
label=""
9 [label="9"]
10 [label="10"]
}
subgraph cluster_3 {
color=green
label=""
8 [label="8"]
}
subgraph cluster_4 {
color=green
label=""
7 [label="7"]
}
subgraph cluster_5 {
color=black
label=""
2 [label="2"]
}
subgraph cluster_6 {
color=red
label=""
4 [label="4"]
}
subgraph cluster_7 {
color=green
label=""
1 [label="1"]
3 [label="3"]
}
0 -> 0 [label="a & b\n{0,1,2}"]
0 -> 0 [label="!a & !b\n{2}"]
0 -> 5 [label="a\n{2}"]
1 -> 4 [label="b"]
1 -> 3 [label="a & !b"]
2 -> 0 [label="a"]
2 -> 7 [label="b"]
3 -> 1 [label="a & b\n{0,1}"]
4 -> 4 [label="!b\n{1,2}"]
4 -> 2 [label="b"]
5 -> 6 [label="1"]
6 -> 5 [label="1"]
7 -> 7 [label="!a & b\n{0,1}"]
7 -> 7 [label="a & b\n{0,2}"]
7 -> 8 [label="1"]
8 -> 8 [label="!a & b\n{0,2}"]
8 -> 8 [label="a & b\n{0,1}"]
8 -> 9 [label="1"]
9 -> 9 [label="!a & b\n{0,2}"]
9 -> 10 [label="a & b\n{0,1}"]
10 -> 9 [label="!a & b\n{0,1}"]
10 -> 10 [label="a & b\n{0,2}"]
}
EOF
diff out.dot expected

242
src/tests/sccsimpl.test Executable file
View file

@ -0,0 +1,242 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2011, 2013, 2015 Laboratoire de Recherche et
# Développement de l'Epita
#
# 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
# This file tests the logic for simplifying superfluous
# acceptance conditions. Especially those whose presence
# are implied by others. This simplification is done as
# part of option -R3.
# The following automaton was generated for
# G((!p0 | !p2 | (!p1 W (!p1 & p3 & X(!p1 U p4)))) U p1)
# The formula does not really matter (except to show how
# such automata can occur). The important point is that the
# acceptance set "0" contains the acceptance set "1", so
# "0" can be removed.
cat <<EOF > aut.txt
HOA: v1
States: 4
Start: 0
AP: 5 "p1" "p0" "p2" "p3" "p4"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 0 {0 1}
[!1 | !2] 0 {0}
[3] 1 {0}
[t] 2 {0}
State: 1
[0&4] 0 {0 1}
[!1&4 | !2&4] 0 {0}
[3&4] 1 {0}
[!0&!1 | !0&!2 | !0&3] 1
[4] 2 {0}
[!0] 3
State: 2
[!0&3] 1 {0}
[!0] 2 {0}
State: 3
[!0&3] 1
[!0&3&4] 1 {0}
[!0&4] 2 {0}
[!0] 3
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut.txt > out.txt
grep '^Acceptance: 1 Inf(0)' out.txt
# Here, acceptance sets 0 and 2 can both be removed.
cat <<EOF > aut2.txt
HOA: v1
States: 1
Start: 0
AP: 4 "a" "b" "c" "d"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 0 {0}
[1] 0 {0 1}
[2] 0 {0 1 2}
[3] 0 {2 3}
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut2.txt > out2.txt
grep '^Acceptance: 2 ' out2.txt
# only 3 transitions output, because [1] and [2] have been merged
test `grep -c '\[.*\]' out2.txt` = 3
# Here, acceptance sets 0 and 1 can both be removed.
cat <<EOF > aut3.txt
HOA: v1
States: 1
Start: 0
AP: 4 "a" "b" "c" "d"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 0 {0}
[1] 0 {0 1}
[2] 0 {0 1 2}
[3] 0 {1 3}
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut3.txt > out3.txt
grep '^Acceptance: 2 ' out3.txt
# only 3 transitions output, because [0] and [1] have been merged
test `grep -c '\[.*\]' out3.txt` = 3
# No simplification possible here
cat <<EOF > aut4.txt
HOA: v1
States: 1
Start: 0
AP: 5 "a" "b" "c" "d" "e"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 0 {0}
[1] 0 {0 1}
[2] 0 {0 1 2}
[3] 0 {1 3}
[4] 0 {2 3}
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut4.txt > out4.txt
grep '^Acceptance: 4 ' out4.txt
test `grep -c '\[.*\]' out4.txt` = 5
# Make sure nothing wrong (like an assert())
# happens when no acceptance conditions are used.
cat <<EOF > aut5.txt
HOA: v1
States: 1
Start: 0
AP: 3 "a" "b" "c"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0] 0
[1 | 2] 0
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut5.txt > out5.txt
grep '^Acceptance: 0 t' out5.txt
test `grep -c '\[.*\]' out5.txt` = 1
# Here, one of 0,1 and one of 2,3 can be removed.
cat <<EOF > aut6.txt
HOA: v1
States: 1
Start: 0
AP: 4 "a" "b" "c" "d"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 0 {0 1}
[1] 0 {0 1}
[2] 0 {2 3}
[3] 0 {2 3}
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut6.txt > out6.txt
grep '^Acceptance: 2 ' out6.txt
test `grep -c '\[.*\]' out6.txt` = 2
# This automaton comes from the formula
# 1 U (p0 & (!p1 R ((1 U !p2) & (1 U !p3))))
# and an early implementation of our simplification
# missed the simplification.
cat <<EOF > aut7.txt
HOA: v1
States: 6
Start: 0
AP: 4 "p0" "p1" "p2" "p3"
acc-name: generalized-Buchi 3
Acceptance: 3 Inf(0)&Inf(1)&Inf(2)
properties: trans-labels explicit-labels trans-acc complete
--BODY--
State: 0
[!0 | 1 | 2 | 3] 0 {1 2}
[0&!1&!2&!3] 1 {0 1 2}
[0&!1&2&!3] 2 {0 1}
[0&!1&!2&3] 3 {0 2}
[0&!1&2 | 0&!1&3] 4 {0}
[0&1&!2&!3] 5 {0 1 2}
[0&1&!3 | 0&2&!3] 5 {0 1}
[0&1&!2 | 0&!2&3] 5 {0 2}
[0&1 | 0&2 | 0&3] 5 {0}
State: 1
[t] 1 {0 1 2}
State: 2
[!2] 1 {0 1 2}
[2] 2 {0 1}
State: 3
[!3] 1 {0 1 2}
[3] 3 {0 2}
State: 4
[!2&!3] 1 {0 1 2}
[2&!3] 2 {0 1}
[!2&3] 3 {0 2}
[2 | 3] 4 {0}
State: 5
[!1&!2&!3] 1 {0 1 2}
[!1&2&!3] 2 {0 1}
[!1&!2&3] 3 {0 2}
[!1&2 | !1&3] 4 {0}
[1 | 2 | 3] 5 {0}
[1&!2&!3] 5 {0 1 2}
[1&!3 | 2&!3] 5 {0 1}
[1&!2 | !2&3] 5 {0 2}
--END--
EOF
run 0 ../ltl2tgba -XH -R3 -H aut7.txt > out7.txt
grep '^Acceptance: 2 ' out7.txt
run 0 ../ltl2tgba -R3 -H '(GFa&GFb) | (GFc&GFd)' > out8.txt
grep 'Acceptance: 2 ' out8.txt
# This formula gives a 12-state automaton in which one acceptance
# condition can be removed, and after what direct simulation should
# simplify the automaton to 6 states.
run 0 ../ltl2tgba -R3 -s -RDS -ks \
'(G(!((b) R (a)))) R (((c) R (!(d))) U (G((a) | (!(G(e))))))' > out9.txt
grep 'states: 6$' out9.txt

28
src/tests/sim2.test Executable file
View file

@ -0,0 +1,28 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 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
../ltl2tgba -H -x -R3f -RDS '{(a&b)[*3]}<>=>G(a&!b)' > ref
for i in -R3 -R3f '-R3 -RDS' '-R3f -RDS'; do
../ltl2tgba -Pref -E -x $i '(X!b R F!a) U (!a | G!b)'
done

40
src/tests/simdet.test Executable file
View file

@ -0,0 +1,40 @@
#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012 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
run 0 ../ltl2tgba -R3 -RIS \
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
> exp
run 0 ../ltl2tgba -R3 -RIS \
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
> out
diff exp out
run 0 ../ltl2tgba -R3 -RIS \
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
> out
diff exp out
rm exp out

285
src/tests/spotlbtt.test Executable file
View file

@ -0,0 +1,285 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2014, 2015 Laboratoire de
# Recherche et Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005, 2006, 2007 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 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/>.
echo 'This test can take as long as 15 minutes on a 2GHz Pentium 4.'
. ./defs
need_lbtt
set -e
cat > config <<EOF
Algorithm
{
Name = "Spot (Couvreur -- LaCIM), fake"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -T'"
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), reduction of formula (pre reduction)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), reduction7 of formula (pre reduction)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r7 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM) reduction7+ru of formula (pre reduction)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r7 -ru -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), reduction of formula in FM"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -fr -r4 -F -f -t'"
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM) reduction7 of formula in FM"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -fr -r7 -F -f -t'"
Enabled = no
}
Algorithm
{
Name = "Spot (Couvreur -- FM), post reduction with scc"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -R3 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), +pre +WDBA"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R3 -Rm -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), +pre +WDBA(rejbig)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -r4 -R3 -RM -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), without symb_merge"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -y -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), degeneralized"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -DT'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), simulated"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RDS -r4 -R3'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), cosimulated"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RRS -r4 -R3'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), iterated simulation"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RIS -r4 -R3'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- TAA), simulated"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -taa -t -RDS -r4 -R3'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), simulated and degeneralized on states."
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -RDS -DS'"
Enabled = yes
}
Algorithm
{
Name = "Compositional Suspension"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -u -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Compositional Suspension (-r4)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -u -r4 -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Compositional Suspension (-r4 -ru)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -u -r4 -ru -F -f -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM), degeneralized on states"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -t -DS'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM post_branch + exprop)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -x -p -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM post_branch + exprop + flapprox)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -x -p -L -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM post_branch + exprop), degeneralized"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -p -x -t -DT'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Couvreur -- FM post_branch + exprop + flapprox), degeneralized"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -f -p -x -t -L -DT'"
ENABLED = yes
}
Algorithm
{
Name = "Spot (Tauriainen -- TAA)"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -taa -t'"
Enabled = yes
}
Algorithm
{
Name = "Spot (Tauriainen -- TAA) refined rules"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../ltl2tgba -F -taa -t -c'"
Enabled = yes
}
GlobalOptions
{
Rounds = 100
Interactive = Never
# Verbosity = 5
# ComparisonCheck = no
# ConsistencyCheck = no
# IntersectionCheck = no
}
FormulaOptions
{
Size = 1...13
Propositions = 6
AbbreviatedOperators = Yes
GenerateMode = Normal
OutputMode = Normal
PropositionPriority = 50
TruePriority = 1
FalsePriority = 1
AndPriority = 10
OrPriority = 10
XorPriority = 0
# EquivalencePriority = 0
BeforePriority = 0
DefaultOperatorPriority = 5
}
EOF
${LBTT}
rm config

79
src/tests/spotlbtt2.test Executable file
View file

@ -0,0 +1,79 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012 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
rm -f config
for type in tgba ba; do
for pref in any deterministic small; do
for level in low medium high; do
cat >>config <<EOF
Algorithm
{
Name = "$type $pref $level"
Path = "${LBTT_TRANSLATE}"
Parameters = "--spot '../../bin/ltl2tgba --$type --$pref --$level --lbtt -F'"
Enabled = yes
}
EOF
done
done
done
cat >>config <<EOF
GlobalOptions
{
Rounds = 100
Interactive = Never
# Verbosity = 5
# ComparisonCheck = no
# ConsistencyCheck = no
# IntersectionCheck = no
}
FormulaOptions
{
Size = 5...20
Propositions = 6
AbbreviatedOperators = Yes
GenerateMode = Normal
OutputMode = Normal
PropositionPriority = 50
TruePriority = 1
FalsePriority = 1
AndPriority = 10
OrPriority = 10
XorPriority = 0
# EquivalencePriority = 0
BeforePriority = 0
DefaultOperatorPriority = 5
}
EOF
${LBTT}
rm config

73
src/tests/stutter-tgba.test Executable file
View file

@ -0,0 +1,73 @@
#! /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 || exit 1
set -e
ltl2tgba=../../bin/ltl2tgba
autfilt=../../bin/autfilt
$ltl2tgba '!FG(a | Xa | G!a)' -H | $autfilt -H --destut > pos.hoa
$ltl2tgba 'FG(a | Xa | G!a)' -H | $autfilt -H --destut > neg.hoa
$autfilt pos.hoa --product neg.hoa -H > prod.hoa
$autfilt --is-empty prod.hoa -q && exit 1
$autfilt --states=10 prod.hoa -q
$ltl2tgba '!FG(a | Xa | G!a)' -H | $autfilt -H --instut > pos.hoa
$ltl2tgba 'FG(a | Xa | G!a)' -H | $autfilt -H --instut > neg.hoa
$autfilt pos.hoa --product neg.hoa -H > prod.hoa
$autfilt --is-empty prod.hoa -q && exit 1
$autfilt --states=12 prod.hoa -q
# Check for issue #7.
#
# We just run those without checking the output, it is enough to
# trigger assertions in the HOA output routines.
run 0 $ltl2tgba -H 'X(a U b)' > det.hoa
run 0 $autfilt --destut det.hoa -H
run 0 $autfilt --instut=1 det.hoa -H
run 0 $autfilt --instut=2 det.hoa -H
$ltl2tgba -H 'a & Fb' | $autfilt --destut -H > output
cat >expected <<EOF
HOA: v1
name: "a & Fb"
States: 3
Start: 2
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc deterministic
--BODY--
State: 0
[t] 0 {0}
State: 1
[1] 0 {0}
[!1] 1
State: 2
[0&1] 0 {0}
[0&!1] 1
--END--
EOF
diff output expected

56
src/tests/taatgba.cc Normal file
View file

@ -0,0 +1,56 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2014 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/>.
#include <iostream>
#include <cassert>
#include "misc/hash.hh"
#include "ltlenv/defaultenv.hh"
#include "ltlast/allnodes.hh"
#include "twaalgos/dotty.hh"
#include "twa/taatgba.hh"
int
main()
{
{
spot::ltl::default_environment& e =
spot::ltl::default_environment::instance();
auto a = spot::make_taa_tgba_string(spot::make_bdd_dict());
typedef spot::taa_tgba::transition trans;
std::string ss1_values[] = { "state 2", "state 3" };
std::vector<std::string> ss1_vector(ss1_values, ss1_values + 2);
trans* t1 = a->create_transition("state 1", ss1_vector);
trans* t2 = a->create_transition("state 2", "state 3");
trans* t3 = a->create_transition("state 2", "state 4");
a->add_condition(t1, e.require("a"));
a->add_condition(t2, e.require("b"));
a->add_condition(t3, e.require("c"));
a->set_init_state("state 1");
spot::dotty_reachable(std::cout, a);
}
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
}

24
src/tests/taatgba.test Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 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 || exit -1
set -e
run 0 ../taatgba || exit 1

113
src/tests/tripprod.test Executable file
View file

@ -0,0 +1,113 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2008, 2009, 2013, 2014, 2015 Laboratoire de Recherche
# et Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 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 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
cat >input1 <<EOF
HOA: v1
States: 3
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc
--BODY--
State: 0
[0] 1 {0}
[1] 2 {0}
State: 1
State: 2
[!0] 0 {0}
[2] 1
--END--
EOF
cat >input2 <<EOF
HOA: v1
States: 2
Start: 0
AP: 2 "b" "a"
acc-name: generalized-Buchi 2
Acceptance: 2 Inf(0)&Inf(1)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0 {0}
[0] 1
State: 1 {1}
[1] 0
--END--
EOF
cat >input3 <<EOF
HOA: v1
States: 3
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0] 1
[1] 2
State: 1 {0}
[t] 2
State: 2 {0}
[t] 1
--END--
EOF
cat >expected <<EOF
HOA: v1
States: 7
Start: 0
AP: 3 "b" "a" "c"
acc-name: generalized-Buchi 4
Acceptance: 4 Inf(0)&Inf(1)&Inf(2)&Inf(3)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0 {0 1}
[0&1] 1
[0&1] 2
[0&1] 3
[0] 4
State: 1
State: 2
State: 3 {2 3}
[1&2] 5
State: 4 {2 3}
[1&2] 6
State: 5
State: 6
--END--
EOF
run 0 ../../bin/autfilt input1 --product input2 --product input3 --hoa |
tee stdout
run 0 ../../bin/autfilt -F stdout --isomorph expected
rm input1 input2 input3 stdout expected

54
src/tests/uniq.test Executable file
View file

@ -0,0 +1,54 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 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
../../bin/randaut a b -S5 --hoa > aut1
../../bin/randaut a b c -S10 --hoa > aut2
../../bin/autfilt --randomize aut1 --hoa > rand11
../../bin/autfilt --randomize --seed=1 aut1 --hoa > rand12
../../bin/autfilt --randomize --seed=2 aut1 --hoa > rand13
../../bin/autfilt --randomize aut2 --hoa > rand21
../../bin/autfilt --randomize --seed=1 aut2 --hoa > rand22
../../bin/autfilt --randomize --seed=2 aut2 --hoa > rand23
cat aut1 aut2 > aut
cat aut1 aut2 rand11 rand12 rand13 rand21 rand22 rand23 > all
../../bin/autfilt all --uniq --hoa > out
diff aut out
run 0 ../../bin/randaut -Hl -u -n 4 -S1 a b | sort |
../../bin/autfilt -H | grep '&' > out
cat >expected <<EOF
[!0&!1] 0
[!0&1] 0
[0&!1] 0
[0&1] 0
EOF
diff out expected
# This should fail: the random automaton generator can only generate 4
# different one-state automaton with two atomic propositions.
../../bin/randaut -Hl -u -n 5 -S1 a b >out 2>stderr && exit 1
test $? = 2
grep 'failed to generate a new unique automaton' stderr
test 4 = `wc -l < out`

134
src/tests/wdba.test Executable file
View file

@ -0,0 +1,134 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 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 +x
set -e
cat >obligations.txt <<EOF
G(!p)
Fr->(!p U r)
G(q->G(!p))
G((q&!r&Fr)->(!p U r))
G(q&!r->((!p U r)|G!p ))
(!r U (p&!r))|(G!r)
G(q&!r->((!r U (p&!r))|G!r))
(!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p
Fr->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r)))))))))
Fq->(!q U (q&((!p U ((p U ((!p U ((p U G!p)|Gp))|G!p))|Gp))|G!p)))
G((q&Fr)->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|(!p U r))))))))))
G(q->((!p&!r)U(r|((p&!r)U(r|((!p&!r)U(r|((p&!r)U(r|((!p U r)|G!p)|Gp)))))))))
G(p)
Fr->(p U r)
G(q->G(p))
G((p&!r&Fr)->(p U r))
G(q&!r->((p U r)|Gp))
Fr->(!p U (s|r))
G((q&!r&Fr)->(!p U (s|r)))
G(q&!r->((!p U (s|r))|G!p))
Fr->(p->(!r U (s&!r))) U r
G((q&!r&Fr)->(p->(!r U (s&!r))) U r)
Fp->(!p U (s&!p&X(!p U t)))
Fr->(!p U (r|(s&!p&X(!p U t))))
(G!q)|(!q U (q&Fp->(!p U (s&!p&X(!p U t)))))
G((q&Fr)->(!p U (r|(s&!p&X(!p U t)))))
G(q->(Fp->(!p U (r|(s&!p&X(!p U t))))))
(F(s&XFt))->((!s) U p)
Fr->((!(s&(!r)&X(!r U (t&!r))))U(r|p))
(G!q)|((!q)U(q&((F(s&XFt))->((!s) U p))))
G((q&Fr)->((!(s&(!r)&X(!r U (t&!r))))U(r|p)))
Fr->(p->(!r U (s&!r&X(!r U t)))) U r
G((q&Fr)->(p->(!r U (s&!r&X(!r U t)))) U r)
Fr->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r
G((q&Fr)->(p->(!r U (s&!r&!z&X((!r&!z) U t)))) U r)
Fp
G(!q)|F(q&Fp)
(!p U s)|Gp
G(q->(!(s&(!r)&X(!r U (t&!r)))U(r|p)|G(!(s&XFt))))
Fr->(s&X(!r U t)->X(!r U (t&Fp))) U r
EOF
cat >non-obligations.txt <<EOF
G(q&!r->(!r U (p&!r)))
G!q|F(q&((!p U s)|G!p))
G(p->Fs)
G(q->G(p->Fs))
G(q&!r->(((p->(!r U (s&!r))) U r)|G(p->(!r U (s&!r)))))
G(s&XFt->X(F(t&Fp)))
G(q->G(s&XFt->X(!t U (t&Fp))))
G((q&Fr)->(s&X(!r U t)->X(!r U (t&Fp))) U r)
G(q->(s&X(!r U t)->X(!r U (t&Fp)))U(r|G(s&X(!r U t)->X(!r U (t&Fp)))))
G(p->F(s&XFt))
G(q->G(p->(s&XFt)))
G(q->(p->(!r U (s&!r&X(!r U t))))U(r|G(p->(s&XFt))))
G(p->F(s&!z&X(!z U t)))
G(q->G(p->(s&!z&X(!z U t))))
G(q->(p->(!r U (s&!r&!z&X((!r&!z) U t))))U(r|G(p->(s&!z&X(!z U t)))))
EOF
success=:
i=0
while read f; do
# Run ltl2tgba through valgrind with some combination of options to
# detect any crash. Do that only for the first few formula, because
# it takes a long time.
if test $i -lt 5; then
run 0 ../ltl2tgba -f -R3 -DS -Rm "!($f)" >/dev/null
i=`expr $i + 1`
fi
# If the labels of the state have only digits, assume the minimization
# worked.
x=`../ltl2tgba -f -Rm "!($f)" |
grep -v -- '->' |
sed -n 's/.*label="\(..*\)".*/\1/p' |
tr -d '0-9\n'`
case $x in
"") echo "OK !($f)";;
*) echo "KO !($f)"; success=false;;
esac
done < obligations.txt
echo ====
i=0
while read f; do
# Run ltl2tgba through valgrind with ANOTHER combination of options
# to detect any crash. Do that only for the first few formula, because
# it takes a long time.
if test $i -lt 5; then
run 0 ../ltl2tgba -taa -DS -Rm "!($f)" >/dev/null
i=`expr $i + 1`
fi
# If the labels of the state have only digits, assume the minimization
# worked.
../ltl2tgba -kt -Rm "!($f)" > out1
../ltl2tgba -kt -R3 "!($f)" > out2
if cmp out1 out2; then
echo "OK !($f)";
else
echo "wrongly minimized !($f)";
success=false;
fi
done < non-obligations.txt
$success

39
src/tests/wdba2.test Executable file
View file

@ -0,0 +1,39 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2014 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
cat >expected <<EOF
sub trans.: 16
transitions: 8
states: 4
nondeterministic states: 0
EOF
# These two equivalent formulae used to produce
# minimized automata of different sizes...
run 0 ../ltl2tgba -Rm -kt 'a | X(Gd|Fa)' > out
run 0 ../ltl2tgba -Rm -kt 'Fa | XGd' > out2
cmp out expected
cmp out2 expected