spot/tests/core/sonf.test
Antoine Martin bdae5563c6 ltlfilt: add --sonf and --sonf-aps flags
* bin/ltlfilt.cc: Here.
* NEWS: Mention new ltlfilt flags.
* tests/Makefile.am, tests/core/sonf.test: Test these flags.
2022-03-03 12:42:26 +01:00

85 lines
2.8 KiB
Bash

#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2021 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
G(c -> Fa) & G(b -> ({x[*]}[]-> c))
{x[*]}[]-> F({y[*]}<>-> GFz)
<>(({{p12}[*0..3]}[]-> ((p9) || (!(p17)))) V ((true) U (p17)))
{{true} || {[*0]}}[]-> (false)
{{p14} & {{p0}[*]}}[]-> (p11)
{{{!{p6}} -> {!{p3}}}[*]}[]-> ((p3)V((p3) || ((X((false))) && ((p2)V(p18)))))
X({{true} || {[*0]}}[]-> ((p17) U ((p8) && (p17))))
({{{p4} || {p5} || {{p16} <-> {{p15} -> {p11}}}}[*]}[]-> (false)) -> (p8)
{[*1..6]}[]-> ((p9) V ((p9) || (!((p4) && (p19)))))
X({{{[*0]} || {{{p10};{p14}}[:*2..3]}}[:*]}<>-> (p8))
{{true} && {{p8}[*]}}<>-> (!(p10))
<>(!(({{p7}[*1..2]}<>-> (p11)) V ((!(p9)) && ([]((p11) || (X(p10)))))))
<>({{!{{p5} || {{!{p2}} <-> {p7}}}} & {[*]}}<>-> (p17))
{{p0} || {{{[*0..2]}[:*2]}[*]}}<>-> ((p1) && (p6))
EOF
cat >expected <<EOF
G(!c|Fa)&G(!b|({x[*]}[]-> c))
s1&G(!s2|GFz)&G(!s0|({y[*]}<>-> s2))&G(!s3|Fs0)&G(!s1|({x[*]}[]-> s3))
F(s0 R (1 U p17))&G(p9|!p17|!s1)&G(!s0|({p12[*0..3]}[]-> s1))
s0&G!s1&G(!s0|({1|[*0]}[]-> s1))
s0&G(!s0|({p14&p0[*]}[]-> p11))
s0&G(!s1|(p3 R (p3|(X(0)&(p2 R p18)))))&G(!s0|({{!p3|p6}[*]}[]-> s1))
Xs0&G(!s1|(p17 U (p8&p17)))&G(!s0|({1|[*0]}[]-> s1))
(p8|s0)&G(!s0|({{p4|p5|{p16 && {p11|!p15}}|{!p11 && p15 && !p16}}[*]}<>-> s1))
s0&G(!s1|(p9 R (!p4|p9|!p19)))&G(!s0|({[*1..6]}[]-> s1))
G(!s0|({{[*0]|{p10;p14}[:*2..3]}[:*]}<>-> p8))&Xs0
s0&G(!p10|!s1)&G(!s0|({1 && p8[*]}<>-> s1))
F(s0 U (p9|F(!p11&X!p10)))&G(!p11|!s1)&G(!s0|({p7[*1..2]}[]-> s1))
G(!s0|({{!p5 && {{!p2 && !p7}|{p2 && p7}}}&[*]}<>-> p17))&Fs0
s0&G(!s1|(p1&p6))&G(!s0|({p0|[*0..2][:*2][*]}<>-> s1))
EOF
cat >expected-aps <<EOF
s0 s1 s2 s3
s0 s1
s0 s1
s0
s0 s1
s0 s1
s0 s1
s0 s1
s0
s0 s1
s0 s1
s0
s0 s1
EOF
ltlfilt -F input --sonf=s --sonf-aps=stdout-aps \
| sed 's/ \([|&]\) /\1/g' > stdout
diff expected stdout
diff expected-aps stdout-aps
# check idempotence
ltlfilt -F expected --sonf=s --sonf-aps=stdout-aps \
| sed 's/ \([|&]\) /\1/g' > stdout
diff expected stdout
# should be 14 empty lines, no new aps introduced this time
test "$(wc -l -m stdout-aps | awk '{print $1 " " $2}')" = "14 14"