dstar.test 4.79 KB
Newer Older
1
2
#!/bin/sh
# -*- coding: utf-8 -*-
3
# Copyright (C) 2013, 2014 Laboratoire de Recherche et
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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/>.

# 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

28
29
30

# DRA generated with
#  ltlfilt -f 'a U b' -l | ltl2dstar --ltl2nba=spin:path/ltl2tgba@-s - -
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cat >dra.dstar <<EOF
DRA v2 explicit
Comment: "Safra[NBA=2]"
States: 3
Acceptance-Pairs: 1
Start: 0
AP: 2 "a" "b"
---
State: 0
Acc-Sig:
1
0
2
2
State: 1
Acc-Sig: -0
1
1
1
1
State: 2
Acc-Sig: +0
2
2
2
2
EOF

run 0 ../ltl2tgba -XD dra.dstar | tee stdout

cat >expected <<EOF
digraph G {
63
64
  rankdir=LR
  0 [label="", style=invis, width=0]
65
66
  0 -> 1
  1 [label="0"]
67
68
69
  1 -> 1 [label="a & !b"]
  1 -> 2 [label="!a & !b"]
  1 -> 3 [label="b"]
70
  2 [label="1"]
71
  2 -> 2 [label="1"]
72
  3 [label="2"]
73
  3 -> 3 [label="1"]
74
75
76
77
78
}
EOF

diff expected stdout

79
80
81
82
83

run 0 ../ltl2tgba -XDD dra.dstar | tee stdout

cat >expected <<EOF
digraph G {
84
85
  rankdir=LR
  0 [label="", style=invis, width=0]
86
  0 -> 1
87
  1 [label="0"]
88
89
  1 -> 1 [label="a & !b"]
  1 -> 2 [label="b"]
90
  2 [label="1", peripheries=2]
91
  2 -> 2 [label="1"]
92
93
94
95
96
97
98
99
100
101
}
EOF

diff expected stdout



# DSA generated with
#   ltlfilt -f 'FGa' -l |
#   ltl2dstar --automata=streett --ltl2nba=spin:path/ltl2tgba@-s - -
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
cat >dsa.dstar <<EOF
DSA v2 explicit
Comment: "Streett{Safra[NBA=2]}"
States: 3
Acceptance-Pairs: 1
Start: 1
AP: 1 "a"
---
State: 0
Acc-Sig: +0
0
2
State: 1
Acc-Sig:
0
0
State: 2
Acc-Sig:
0
2
EOF

run 0 ../ltl2tgba -XDB dsa.dstar | tee stdout

cat >expected <<EOF
digraph G {
128
129
  rankdir=LR
  0 [label="", style=invis, width=0]
130
131
  0 -> 1
  1 [label="0"]
132
133
  1 -> 2 [label="1"]
  1 -> 3 [label="1"]
134
  2 [label="1"]
135
136
137
138
  2 -> 2 [label="!a"]
  2 -> 3 [label="!a"]
  2 -> 4 [label="a"]
  2 -> 5 [label="a"]
139
  3 [label="2"]
140
141
  3 -> 6 [label="!a"]
  3 -> 5 [label="a\n{0}"]
142
  4 [label="3"]
143
144
145
146
  4 -> 2 [label="!a"]
  4 -> 3 [label="!a"]
  4 -> 4 [label="a"]
  4 -> 5 [label="a"]
147
  5 [label="4"]
148
149
  5 -> 6 [label="!a"]
  5 -> 5 [label="a\n{0}"]
150
  6 [label="5"]
151
152
  6 -> 6 [label="!a"]
  6 -> 7 [label="a"]
153
  7 [label="6"]
154
155
  7 -> 6 [label="!a"]
  7 -> 7 [label="a"]
156
157
158
159
}
EOF

diff expected stdout
160

161
162
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"
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216



# 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 <<EOF
DRA v2 explicit
Comment: "Union{Safra[NBA=1],Safra[NBA=2]}"
States: 5
Acceptance-Pairs: 2
Start: 0
AP: 2 "a" "b"
---
State: 0 "bla"
Acc-Sig:
1
2  /* This is a comment */
3
4
State: 1 "foo"
Acc-Sig: -0
1
1 // This is another comment.
3
3
State: 2 "baz"
Acc-Sig: +0
1
2
// more
/// comment
3
4
State: 3 "str\n\"ing"
Acc-Sig: -0 +1
3  /***
   **** Some multiline comment
   ***/
3
3
3
State: 4 "more\"string\""
Acc-Sig: +0 +1
3
4
3
4
EOF

run 0 ../ltl2tgba -XDD dra.dstar | tee stdout

cat >expected <<EOF
digraph G {
217
218
  rankdir=LR
  0 [label="", style=invis, width=0]
219
  0 -> 1
220
  1 [label="0"]
221
222
223
224
  1 -> 2 [label="!a & !b"]
  1 -> 3 [label="a & !b"]
  1 -> 4 [label="!a & b"]
  1 -> 5 [label="a & b"]
225
  2 [label="1"]
226
227
  2 -> 2 [label="!b"]
  2 -> 4 [label="b"]
228
  3 [label="2", peripheries=2]
229
230
231
232
  3 -> 2 [label="!a & !b"]
  3 -> 3 [label="a & !b"]
  3 -> 4 [label="!a & b"]
  3 -> 5 [label="a & b"]
233
  4 [label="3", peripheries=2]
234
  4 -> 4 [label="1"]
235
  5 [label="4", peripheries=2]
236
237
  5 -> 4 [label="!a"]
  5 -> 5 [label="a"]
238
239
240
241
}
EOF

diff expected stdout
242
243

test "`../../bin/dstar2tgba -D dra.dstar --stats '%s %t %p %d'`" = "3 12 1 1"
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262

# This has caused a crash at some point when dealing with 0-sized
# bitsets to represent acceptance sets.
cat >aut.dsa <<EOF
DSA v2 explicit
Comment: "Streett{Safra[NBA=1]}"
States: 1
Acceptance-Pairs: 0
Start: 0
AP: 0
---
State: 0
Acc-Sig:
0
EOF
run 0 ../ltl2tgba -XDD aut.dsa | tee stdout

cat >expected<<EOF
digraph G {
263
264
  rankdir=LR
  0 [label="", style=invis, width=0]
265
266
  0 -> 1
  1 [label="0"]
267
268
  1 -> 1 [label="1"]
  1 -> 2 [label="1"]
269
  2 [label="1"]
270
  2 -> 2 [label="1"]
271
272
273
274
}
EOF

diff expected stdout