* src/hoaparse/parsedecl.hh (hoa_abort): New structure. * src/hoaparse/hoascan.ll: Throw hoa_abort on --ABORT--. * src/hoaparse/hoaparse.yy: Deal with this exception. * src/hoaparse/public.hh: Add a boolean flag to mark aborted automata. * src/bin/autfilt.cc: Report aborted automata. * src/tgbatest/hoaparse.test: Add test case.
448 lines
7.8 KiB
Bash
Executable file
448 lines
7.8 KiB
Bash
Executable file
#!/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
|
|
|
|
expecterr()
|
|
{
|
|
cat >$1.exp
|
|
../../bin/autfilt --hoa $1 2>$1.err >$1.out && exit 1
|
|
test $? = 2
|
|
cat $1.err
|
|
diff $1.err $1.exp
|
|
}
|
|
|
|
expectok()
|
|
{
|
|
cat >$1.exp
|
|
../../bin/autfilt --hoa $1 >$1.out
|
|
test $? = 0
|
|
cat $1.out
|
|
diff $1.out $1.exp
|
|
}
|
|
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
States: 1
|
|
Start: 0
|
|
AP: 1 "a"
|
|
States: 2
|
|
Acceptance: 1 Inf(0)
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 1
|
|
State: 1 {0}
|
|
[t] 1
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:5.1-9: redefinition of the number of states...
|
|
input:2.1-9: ... previously defined here.
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
States: 1
|
|
Start: 0
|
|
AP: 1 "a"
|
|
Acceptance: 1 Inf(0)
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 1
|
|
State: 1 {0}
|
|
[t] 1
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:8.5: state number is larger than state count...
|
|
input:2.1-9: ... declared here.
|
|
input:9.8: state number is larger than state count...
|
|
input:2.1-9: ... declared here.
|
|
input:10.5: state number is larger than state count...
|
|
input:2.1-9: ... declared here.
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
States: 1
|
|
Start: 0
|
|
AP: 1 "a"
|
|
Acceptance: 1 Inf(0)
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 0
|
|
State: 0 {0}
|
|
[t] 0
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:9.1-8: redeclaration of state 0
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
States: 0
|
|
AP: 1 "a" "b"
|
|
Acceptance: 0 t
|
|
--BODY--
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:3.1-13: found 2 atomic propositions instead of the 1 announced
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
AP: 1 "a"
|
|
States: 0
|
|
AP: 2 "a" "b"
|
|
Acceptance: 0 t
|
|
--BODY--
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:4.1-3: ignoring this redeclaration of APs...
|
|
input:2.1-5: ... previously declared here.
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
AP: 1 "a"
|
|
States: 0
|
|
Start: 1
|
|
--BODY--
|
|
State: 0 {0 1}
|
|
[0] 0 {0}
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:4.1-8: initial state number is larger than state count...
|
|
input:3.1-9: ... declared here.
|
|
input:1.1-4.8: missing 'Acceptance:' header
|
|
input:6.8: state number is larger than state count...
|
|
input:3.1-9: ... declared here.
|
|
input:6.10-14: ignoring acceptance sets because of missing acceptance condition
|
|
input:7.5: state number is larger than state count...
|
|
input:3.1-9: ... declared here.
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
AP: 1 "a"
|
|
Start: 1
|
|
States: 1
|
|
--BODY--
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:3.1-8: initial state number is larger than state count...
|
|
input:4.1-9: ... declared here.
|
|
input:1.1-4.9: missing 'Acceptance:' header
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
Acceptance: 1 Inf(0)
|
|
Start: 0
|
|
States: 1
|
|
Acceptance: 1 Inf(0)
|
|
--BODY--
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:5.1-13: ignoring this redefinition of the acceptance condition...
|
|
input:2.1-13: ... previously defined here.
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
Start: 0
|
|
AP: 1 "a"
|
|
States: 2
|
|
Acceptance: 1 Inf(0)
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 1
|
|
State: 1 {1}
|
|
[t] 1
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:9.11: number is larger than the count of acceptance sets...
|
|
input:5.1-13: ... declared here.
|
|
EOF
|
|
|
|
# Let's have two broken automata in a row...
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
Start: 0
|
|
AP: 1 "a"
|
|
States: 2
|
|
Acceptance: 1 Inf(2)
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 1
|
|
State: 1 {0}
|
|
[t] 1
|
|
--END--
|
|
HOA: v2
|
|
--BODY--
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:5.19: number is larger than the count of acceptance sets...
|
|
input:5.1-13: ... declared here.
|
|
input:12.1-7: unsupported version of the HOA format
|
|
input:12.1-7: missing 'Acceptance:' header
|
|
EOF
|
|
|
|
cat >input<<EOF
|
|
HOA: v1
|
|
States: 3
|
|
Start: 0
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 (Inf(0) & Inf(1))
|
|
AP: 2 "a" "b"
|
|
--BODY--
|
|
State: 0 "foo" { 0 }
|
|
2 /* !a & !b */
|
|
0 /* a & !b */
|
|
1 /* !a & b */
|
|
1 /* a & b */
|
|
State: 1 { 1 }
|
|
1 1 1 1 /* four transitions on one line */
|
|
State: 2 "sink state" { 0 }
|
|
2 2 2 2
|
|
--END--
|
|
EOF
|
|
|
|
expectok 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 complete deterministic
|
|
--BODY--
|
|
State: 0 {0}
|
|
[!0&!1] 1
|
|
[0&!1] 0
|
|
[!0&1] 2
|
|
[0&1] 2
|
|
State: 1 {0}
|
|
[!0&!1] 1
|
|
[0&!1] 1
|
|
[!0&1] 1
|
|
[0&1] 1
|
|
State: 2 {1}
|
|
[!0&!1] 2
|
|
[0&!1] 2
|
|
[!0&1] 2
|
|
[0&1] 2
|
|
--END--
|
|
EOF
|
|
|
|
cat >input<<EOF
|
|
HOA: v1
|
|
States: 3
|
|
Start: 0
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 (Inf(0) & Inf(1))
|
|
AP: 2 "a" "b"
|
|
--BODY--
|
|
State: 0 "foo" { 0 }
|
|
2 /* !a & !b */
|
|
0 /* a & !b */
|
|
1 /* !a & b */
|
|
/* missing transition */
|
|
State: 1 { 1 }
|
|
1 1 1 1 /* four transitions on one line */
|
|
State: 2 "sink state" { 0 }
|
|
2 2 2 2
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:8.5-11.7: not enough transitions for this state
|
|
EOF
|
|
|
|
cat >input<<EOF
|
|
HOA: v1
|
|
States: 3
|
|
Start: 0
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 (Inf(0) & Inf(1))
|
|
AP: 2 "a" "b"
|
|
--BODY--
|
|
State: 0 "foo" { 0 }
|
|
2 /* !a & !b */
|
|
0 /* a & !b */
|
|
1 /* !a & b */
|
|
1 /* a & b */
|
|
2 /* extra transition ! */
|
|
State: 1 { 1 }
|
|
1 1 1 1 /* four transitions on one line */
|
|
State: 2 "sink state" { 0 }
|
|
2 2 2 2
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:13.7: too many transition for this state, ignoring this one
|
|
EOF
|
|
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
name: "GFa & GF(b & c)"
|
|
States: 1
|
|
Start: 0
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 (Inf(0) & Inf(1))
|
|
AP: 3 "a" "b" "c"
|
|
Alias: @a 0
|
|
Alias: @a 1 & 2 /* should be @bc */
|
|
--BODY--
|
|
State: 0
|
|
[!@a & !@bc] 0
|
|
[@a & !@bc] 0 {0}
|
|
[!@a & @bc] 0 {1}
|
|
[@a & @bc] 0 {0 1}
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:9.5-19: ignoring redefinition of alias @a
|
|
input:12.13-15: unknown alias @bc
|
|
input:13.12-14: unknown alias @bc
|
|
input:14.12-14: unknown alias @bc
|
|
input:15.11-13: unknown alias @bc
|
|
EOF
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
name: "GFa & GF(b & c)"
|
|
States: 1
|
|
Start: 0
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 (Inf(0) & Inf(1))
|
|
AP: 3 "a" "b" "c"
|
|
Alias: @a 0
|
|
Alias: @bc 1 & 2
|
|
--BODY--
|
|
State: 0
|
|
[!@a & !@bc] 0
|
|
[@a & !@bc] 0 {0}
|
|
[!@a & @bc] 0 {1}
|
|
[@a & @bc] 0 {0 1}
|
|
--END--
|
|
EOF
|
|
|
|
expectok input <<EOF
|
|
HOA: v1
|
|
States: 1
|
|
Start: 0
|
|
AP: 3 "a" "b" "c"
|
|
acc-name: generalized-Buchi 2
|
|
Acceptance: 2 Inf(0)&Inf(1)
|
|
properties: trans-labels explicit-labels trans-acc complete deterministic
|
|
--BODY--
|
|
State: 0
|
|
[!0&!1 | !0&!2] 0
|
|
[0&!1 | 0&!2] 0 {0}
|
|
[!0&1&2] 0 {1}
|
|
[0&1&2] 0 {0 1}
|
|
--END--
|
|
EOF
|
|
|
|
|
|
cat >input <<EOF
|
|
HOA: v1
|
|
--ABORT--
|
|
HOA: v1
|
|
States: 2
|
|
Start: 0
|
|
Acceptance: 2 (Inf(0) & Inf(!0)) &
|
|
--ABORT----ABORT--
|
|
HOA: v1
|
|
States: 2
|
|
Start: 0
|
|
Acceptance: 2 (Inf(0) & Inf(!0)) & Inf(!1)
|
|
AP: 1 "a"
|
|
--BODY-- State: 0 {0
|
|
}
|
|
[0] 1
|
|
[!0--ABORT--
|
|
HOA: v1
|
|
States: 2
|
|
Start: 0
|
|
Acceptance: 2 (Inf(0) & Inf(!0)) & Inf(!1)
|
|
AP: 1 "a"
|
|
--BODY--
|
|
State: 0 {0}
|
|
[0] 1
|
|
[!0] 0 {1}
|
|
State: 1
|
|
[!0] 1
|
|
[0] 0
|
|
--END--
|
|
EOF
|
|
|
|
expecterr input <<EOF
|
|
input:1.1-2.9: aborted input automaton
|
|
input:3.1-7.14: aborted input automaton
|
|
input:7.15-23: aborted input automaton
|
|
input:8.1-16.12: aborted input automaton
|
|
EOF
|
|
|
|
cat >expected <<EOF
|
|
HOA: v1
|
|
States: 2
|
|
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 complete deterministic
|
|
--BODY--
|
|
State: 0
|
|
[0] 1 {0 1}
|
|
[!0] 0 {0}
|
|
State: 1
|
|
[!0] 1 {1 2}
|
|
[0] 0 {1 2}
|
|
--END--
|
|
EOF
|
|
|
|
diff expected input.out
|