spot/tests/core/ltlmix.test
Alexandre Duret-Lutz e6ebbdf65f ltlfilt, ltlsynt, ltlmix: add a --part-file option
* bin/common_ioap.cc, bin/common_ioap.hh (read_part_file): New
function.
* bin/ltlfilt.cc, bin/ltlmix.cc, bin/ltlsynt.cc: Use it.
* doc/org/ltlfilt.org, doc/org/ltlmix.org, doc/org/ltlsynt.org:
Mention that new option, and improve the links to its description
in ltlsynt.org.
* NEWS: Mention the new option.
* tests/core/ltlfilt.test, tests/core/ltlmix.test,
tests/core/ltlsynt.test: Adjust test cases.
2024-09-04 16:09:31 +02:00

139 lines
3.7 KiB
Bash
Executable file

#! /bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) by the Spot authors, see the AUTHORS file for details.
#
# 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
# Make sure sort isn't affected by the user's LC_COLLATE
LC_ALL=C
export LC_ALL
ltlmix -fGa -fFb --tree-size=4 -n 50 -o out.ltl 2>stderr && exit 1
grep 'failed to generate a new unique formula' stderr
test 34 -eq `wc -l < out.ltl`
ltlmix -fGa -fFb --tree-size=4 -n 500 -L -o out.ltl 2>stderr && exit 1
grep 'failed to generate a new unique formula' stderr
test 448 -eq `wc -l < out.ltl`
P=--boolean-priorities=not=0,xor=0,equiv=0,implies=0
ltlmix -fGa -fFb --tree-size=4 -n 10 $P -o out.ltl 2>stderr && exit 1
grep 'failed to generate a new unique formula' stderr
test 4 -eq `wc -l < out.ltl`
ltlmix -fa -A9 --tree-size=1 -n9 | sort > list1
ltlmix -fa -P9 --tree-size=1 -n18 | sort > list2
grep -v '!' list2 > list3
diff list1 list3
# The following message appears only if run from a tty.
if (: > /dev/tty) >/dev/null 2>&1 ; then
ltlmix -A9 -n10 </dev/tty 2>err && exit 2
grep 'No formula to combine' err
fi
genltl --gf-equiv-xn=1..3 | ltlmix --tree-size=1 -A2 -n6 | sort >out
cat >expected <<EOF
GF(p0 <-> XXXp0)
GF(p0 <-> XXp0)
GF(p0 <-> Xp0)
GF(p1 <-> XXXp1)
GF(p1 <-> XXp1)
GF(p1 <-> Xp1)
EOF
diff out expected
genltl --and-gf=4 > in.ltl
ltlmix in.ltl --tree-size=1 -A1 --stats=%x > out.txt
ltlmix in.ltl --tree-size=1 -A2 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -A3 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -A4 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -A5 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -A6 --stats=%x >> out.txt
cat >expected <<EOF
1
2
3
4
4
4
EOF
diff out.txt expected
# Using -P won't change the number of atomic propositions
ltlmix in.ltl --tree-size=1 -P1 --stats=%x > out.txt
ltlmix in.ltl --tree-size=1 -P2 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -P3 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -P4 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -P5 --stats=%x >> out.txt
ltlmix in.ltl --tree-size=1 -P6 --stats=%x >> out.txt
diff out.txt expected
ltlmix -fa -A500 $P,or=0 -n10 | tee out
test 10 -eq `grep '&.*&' < out | wc -l`
ltlmix -fa -A500 -C3 -n10 | tee out2
diff out out2
ltlmix -fGi -fFo -A3,3 -C4 -n10 | tee out
cat >expected <<EOF
Fo1 & Gi1 & Gi2 & Fo0
Gi1 & Fo0 & Fo2
Fo1 & Gi1 & Gi2 & Fo2
Gi1 & Fo0 & Gi0
Fo1 & Gi1 & Gi2 & Gi0
Fo1 & Gi1 & Fo0 & Fo2
Fo1 & Gi1 & Fo2
Gi1 & Gi2 & Gi0
Fo1 & Gi1 & Fo0
Fo1 & Fo2 & Gi0
EOF
diff out expected
ltlmix -fGa -fFz -A3,3 --ins='/[a-m]/' -C4 -n10 > out
diff out expected
ltlmix -fGa -fFz -A3,3 --outs='/[m-o]/,z' -C4 -n10 > out
diff out expected
ltlmix -fGa -fFz -A3,3 -C4 -n10 2> err && exit 1
cat err
grep 'ins.*outs' err
echo '.inputs a c .outputs b d ' > part.part
ltlmix -fXa -fGb -f'c U d' --part-file=part.part -C4 -A3,3 -n10 >out
cat >expected <<EOF
(i1 U o2) & Go1 & (i0 U o2)
Go1 & (i0 U o2) & Xi1 & Go2
Go2 & (i2 U o1) & Xi2 & Go0
Go2 & Go0 & (i1 U o0) & Xi0
Go1 & Xi2 & Xi0 & (i0 U o0)
Xi1 & Xi2 & Go0 & (i2 U o0)
Xi1 & (i1 U o0) & Xi0 & (i1 U o1)
Go2 & Xi2 & (i0 U o0)
(i0 U o2) & (i0 U o0) & (i0 U o1)
Go1 & Xi0 & (i0 U o0) & (i0 U o1)
EOF
diff out expected