ltlcross4.test 2.09 KB
Newer Older
1
2
#!/bin/sh
# -*- coding: utf-8 -*-
3
# Copyright (C) 2012-2014, 2017 Laboratoire de Recherche et
4
# Développement de l'Epita (LRDE).
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# 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

test -z "$PYTHON" && exit 77

26
ltl2tgba=ltl2tgba
27
28
29
30
31
32

cat >formulas.txt <<EOF
GFa & GFb
GFa -> GFb
EOF

33
ltlcross -F formulas.txt \
34
35
36
37
38
39
40
41
42
  "{ltl2tgba any} $ltl2tgba --lbtt --any %f > %T" \
  "{ltl2tgba det} $ltl2tgba --lbtt --deterministic %f > %T" \
  "{ltl2tgba sma} $ltl2tgba --lbtt --small %f > %T" \
  --csv=output.csv

cat >test.py <<EOF
import sys
try:
  import pandas
43
  import numpy as np
44
45
46
47
except ImportError:
  sys.exit(77)

x = pandas.read_csv("output.csv")
48
49
50
# We used to call describe() instead of agg(),
# but the output of this function was changed
# in pandas 0.20.
51
print(x.filter(('formula', 'tool',
52
53
54
                'states', 'transitions')).\
        groupby('tool').\
        agg([np.mean, np.std, np.min, np.max]))
55
56
57
58
59
EOF

# will exit 77 if panda is not installed
$PYTHON test.py >out.1

60
61
62
63
64
# remove trailing whitespace from pandas' output, and limit to 6
# lines, because Pandas 0.13 adds the size of the dataframe
# afterwards.  Alse the spacing between columns differs from version
# to version.
sed 's/[ \t]*$//g;6q' <out.1 | sed 's/  */ /g' > py.out
65
66

cat >expected <<EOF
67
68
 states transitions
 mean std amin amax mean std amin amax
69
tool
70
71
72
ltl2tgba any 2.25 0.957427 1 3 10.00 5.163978 4 16
ltl2tgba det 2.25 0.957427 1 3 9.25 4.573474 4 14
ltl2tgba sma 2.25 0.957427 1 3 9.25 4.573474 4 14
73
74
75
EOF

diff py.out expected