ltl2ta.test 4.97 KB
Newer Older
1
#!/bin/sh
2
# Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
3
# Dveloppement de l'Epita (LRDE).
4
5
6
7
8
#
# 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
9
# the Free Software Foundation; either version 3 of the License, or
10
11
12
13
14
15
16
17
# (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
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21
22
23
24
25
26


. ./defs

set -e

check ()
{
27
  run 0 ../ltl2tgba -TA -ks "$1"
28
  run 0 ../ltl2tgba -TA -RT -ks "$1"
29
30
  run 0 ../ltl2tgba -TA -lv -ks "$1"
  run 0 ../ltl2tgba -TA -sp -ks "$1"
31
32
  run 0 ../ltl2tgba -TA -RT -lv "$1"
  run 0 ../ltl2tgba -TA -RT -sp -ks "$1"
33
34
  run 0 ../ltl2tgba -TA -lv -sp -ks "$1"
  run 0 ../ltl2tgba -TA -DS -ks "$1"
35
  run 0 ../ltl2tgba -TA -RT -DS -ks "$1"
36
37
  run 0 ../ltl2tgba -TA -lv -DS -ks "$1"
  run 0 ../ltl2tgba -TA -sp -DS -ks "$1"
38
39
40
  run 0 ../ltl2tgba -TA -RT -sp -DS -ks "$1"
  run 0 ../ltl2tgba -TA -RT -lv -DS -ks "$1"
  run 0 ../ltl2tgba -TA -RT -sp -lv -DS -ks "$1"
41
  run 0 ../ltl2tgba -TGTA -ks "$1"
42
  run 0 ../ltl2tgba -TGTA -RT -ks "$1"
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
}

# We don't check the output, but just running these might be enough to
# trigger assertions.

check a
check 'a U b'
check 'F a'
check 'a & b & c'
check 'a | b | (c U (d & (g U (h ^ i))))'
check 'a & (b U !a) & (b U !a)'
check 'Fa & b & GFc & Gd'
check 'Fa & a & GFc & Gc'
check 'Fc & (a | b) & GF(a | b) & Gc'
check 'a R (b R c)'
check '(a U b) U (c U d)'

check '((Gp2)U(F(1)))&(p1 R(p2 R p0))'



for opt in -TA; do
  ../ltl2tgba -ks $opt -in 'a U (b U c)' > stdout
  grep 'transitions: 144$' stdout
  grep 'states: 21$' stdout
done


71
for opt in -TA; do
72
  ../ltl2tgba -ks $opt -RT -in -DS 'a U (b U c)' > stdout
73
74
75
76
77
78
  grep 'transitions: 69$' stdout
  grep 'states: 10$' stdout
done



79
for opt in  -TA; do
80
  ../ltl2tgba -ks $opt -RT -DS '!(Ga U b)' > stdout
81
82
83
84
  grep 'transitions: 15$' stdout
  grep 'states: 5$' stdout
done

85
86

for opt in -TA; do
87
  ../ltl2tgba -ks $opt -RT -DS 'Ga U b' > stdout
88
89
90
91
92
93
94
95
96
  grep 'transitions: 13$' stdout
  grep 'states: 6$' stdout
done


# Make sure '(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'
# has 21 states and 96 transitions, before minimization.
f='(G (p -> F q)) && ((X (p) U q) || ! X (p U (p && q)))'

Ala-Eddine Ben-Salem's avatar
Ala-Eddine Ben-Salem committed
97
../ltl2tgba -ks -TA  -DS "$f" > stdout
98
99
100
grep 'transitions: 96$' stdout
grep 'states: 21$' stdout

101
# Note:  after minimization with -TA -RT.
102
# has 20 states and 89 transitions, after minimization.
103
../ltl2tgba -ks -TA -RT  -DS "$f" > stdout
104
105
grep 'transitions: 85$' stdout
grep 'states: 19$' stdout
106
107
108


f='GFa & GFb & GFc & GFd & GFe & GFg'
Ala-Eddine Ben-Salem's avatar
Ala-Eddine Ben-Salem committed
109
../ltl2tgba -ks -TA  -DS -x "$f" > stdout
110
111
112
113
114
grep 'transitions: 28351$' stdout
grep 'states: 449$' stdout


f='GFa & GFb & GFc & GFd & GFe & GFg'
115
../ltl2tgba -ks -TA -RT -x -lv  -DS "$f" > stdout
Ala-Eddine Ben-Salem's avatar
Ala-Eddine Ben-Salem committed
116
grep 'transitions: 18496$' stdout
117
118
119
120
grep 'states: 290$' stdout


#tests with artificial livelock state:
Ala-Eddine Ben-Salem's avatar
Ala-Eddine Ben-Salem committed
121
run 0 ../ltl2tgba -ks -TA -lv  -DS "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
122
123
grep 'transitions: 790$' stdout
grep 'states: 66$' stdout
124

125
run 0 ../ltl2tgba -TA -RT -ks -lv -DS  "Gq|Gr|(G(q|FGp)&G(r|FG!p))" >stdout
126
127
grep 'transitions: 390$' stdout
grep 'states: 26$' stdout
128

129
run 0 ../ltl2tgba -TGTA -RT -ks  'Gq|Gr|(G(q|FGp)&G(r|FG!p))' >stdout
130
131
grep 'transitions: 294$' stdout
grep 'states: 21$' stdout
132

133
f="FG((WaitRight4 M (HasRight1 W GWaitLeft0)) M HasLeft4)"
134

135
run 0 ../ltl2tgba -TA -RT -ks -in -R3f -x  -DS  "$f" >stdout
136
137
grep 'transitions: 450$' stdout
grep 'states: 38$' stdout
138
139


140
run 0 ../ltl2tgba -TA -RT -ks -lv -R3f -x  -DS  "$f" >stdout
141
142
grep 'transitions: 555$' stdout
grep 'states: 40$' stdout
143
144


145
run 0 ../ltl2tgba -TA -RT -ks "$f" >stdout
146
147
grep 'transitions: 424$' stdout
grep 'states: 31$' stdout
148
149


150
run 0 ../ltl2tgba -TA -RT -ks -sp -lv -in "$f" >stdout
151
152
grep 'transitions: 485$' stdout
grep 'states: 32$' stdout
153
154


155
run 0 ../ltl2tgba -TA -RT -ks -in -R3 -x  -DS  "$f" >stdout
156
157
grep 'transitions: 450$' stdout
grep 'states: 38$' stdout
158

159
run 0 ../ltl2tgba -TA -RT -ks -sp -lv -R3 -x   -DS "$f" >stdout
160
161
grep 'transitions: 551$' stdout
grep 'states: 40$' stdout
162
163


164
run 0 ../ltl2tgba -TA -ks -sp -lv -DS "$f" >stdout
165
grep 'transitions: 597$' stdout
166
grep 'states: 46$' stdout
167
168


169
run 0 ../ltl2tgba -TA -RT -ks -sp -lv "$f" >stdout
170
171
grep 'transitions: 504$' stdout
grep 'states: 33$' stdout
172

173
run 0 ../ltl2tgba -TGTA -RT -ks "$f" >stdout
174
175
grep 'transitions: 527$' stdout
grep 'states: 32$' stdout
176

177
g="G(F(GWaitLeft7 U Idle4) U (WaitLeft2 M IsEating2))"
178

179
run 0 ../ltl2tgba -TA -RT -ks -DS "$g" >stdout
180
grep 'transitions: 2133$' stdout
181
grep 'states: 97$' stdout
182
183


184
run 0 ../ltl2tgba -TA -RT -ks -sp "$g" >stdout
185
186
grep 'transitions: 887$' stdout
grep 'states: 49$' stdout
187

188
run 0 ../ltl2tgba -TGTA -RT -ks "$g" >stdout
189
190
grep 'transitions: 935$' stdout
grep 'states: 49$' stdout