#!/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 .
# 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 <expected < 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 < 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 <expected < 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 <expected < 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 <expected< 0
0 [label="0"]
0 -> 0 [label="1"]
}
EOF
diff expected stdout