spot/tests/core/scc.test
Alexandre Duret-Lutz 2e90460b8a tests: exercise --stats='%[v]c %[IW]c' and friends
* tests/core/scc.test: Here.
2018-05-18 20:50:48 +02:00

201 lines
3.7 KiB
Bash
Executable file

#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2015, 2017, 2018 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 ltl2tgba --low --any --stats='%f,%e,%s,%c' -F formulas/1 >out
cat out
diff out formulas
ltl2tgba 'a W b' > aut
cat >ref<<EOF
HOA: v1
States: 2
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
properties: terminal
--BODY--
State: 0
[1] 1
[0&!1] 0
State: 1 {0}
[t] 1
--END--
EOF
run 0 autfilt --decompose-scc=a0 aut> out
cat out
diff out ref
cat >ref<<EOF
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc colored
properties: deterministic weak
--BODY--
State: 0 {0}
[0&!1] 0
--END--
EOF
run 0 autfilt --decompose-scc=a1 aut> out
diff out ref
autfilt --decompose-scc=a2 aut 2>stderr && exit 1
[ $? -eq 2 ]
grep "no SCC 'a2'" stderr
autfilt --decompose-scc=2 aut 2>stderr && exit 1
[ $? -eq 2 ]
grep "no SCC 2" stderr
# always satisfied acceptance
ltl2tgba 'Ga R b | Gc R b' > aut
cat >ref<<EOF
HOA: v1
States: 2
Start: 0
AP: 3 "b" "a" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc weak
--BODY--
State: 0
[0] 0
[0&2] 1
State: 1 {0}
[2] 1
--END--
EOF
run 0 autfilt --decompose-scc=a1 -F aut> out
cat out
diff out ref
# From issue #271, reported by Henrich Lauko.
cat >in.hoa <<EOF
HOA: v1
States: 5
Start: 4
AP: 2 "p1" "p0"
acc-name: generalized-co-Buchi 2
Acceptance: 2 Fin(0)|Fin(1)
properties: trans-labels explicit-labels state-acc complete
properties: deterministic
--BODY--
State: 0 {0}
[1] 0
[!1] 1
State: 1 {0 1}
[1] 0
[!1] 1
State: 2
[0&1] 0
[0&!1] 1
[!0&1] 2
[!0&!1] 3
State: 3 {1}
[0&1] 0
[0&!1] 1
[!0&1] 2
[!0&!1] 3
State: 4
[t] 2
--END--
EOF
test '2 1 1 2' = "`autfilt --stats='%[a]c %[A]c %[v]c %[V]c' in.hoa`"
# From issue #284, reported by Juraj Major.
cat >in.hoa <<EOF
HOA: v1
States: 4
Start: 0
AP: 1 "a"
Acceptance: 8 Fin(5) & Fin(3) & (Inf(6) | Fin(7)) &
(Inf(2) | Fin(1)) & (Inf(4) | Fin(0))
properties: trans-labels explicit-labels trans-acc complete
spot.highlight.edges: 3 5 11 5 14 5
--BODY--
State: 0
[t] 0 {0}
[0] 1 {4}
[!0] 2 {4}
[0] 0 {2 3}
[!0] 0 {1}
State: 1
[!0] 1 {0}
[!0] 3 {4}
[!0] 1 {1}
[0] 1 {4 5}
[0] 1 {2 3 5}
State: 2
[0] 2 {0 6}
[0] 3 {4 6}
[0] 2 {2 3 6}
[!0] 2 {4 7}
State: 3
[0] 3 {4 5 6}
[0] 3 {2 3 5 6}
[!0] 3 {4 7}
--END--
/* this variant also cause some issues while fixing the above */
HOA: v1
States: 1
Start: 0
AP: 1 "a"
Acceptance: 5 Fin(0) & (Inf(1) | Fin(2)) & (Inf(4))
--BODY--
State: 0
[0] 0 {1}
[0] 0 {0 1}
[!0] 0 {4 2}
--END--
EOF
autfilt --stats='%[a]c %[iw]c %[IW]c' in.hoa >out
cat >exp <<EOF
1 3 1
1 0 1
EOF
diff out exp
autfilt --stats='%[I]c' in.hoa 2>err && exit 1
grep "unknown option 'I" err
autfilt --stats='%[i]c' in.hoa 2>err && exit 1
grep "unknown option 'i" err