#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2012, 2013 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 <http://www.gnu.org/licenses/>.

. ./defs
set -e

cat >expected.1<<EOF
FGa, 0 0
GFa, 1 1
a U b, 1 0
G(!r | Fa) | Fx, 0 1
EOF

# also test the filename/COL syntax
run 0 ../../bin/ltl2tgba -F expected.1/1 --stats='%f, %d %p' >out.1
diff out.1 expected.1

cat >expected.2<<EOF
FGa, 0 1
GFa, 1 1
a U b, 1 1
G(!r | Fa) | Fx, 0 1
EOF

# filename/COL should also work when filename=-
run 0 ../../bin/ltl2tgba -C -F-/1 --stats='%f, %d %p' <expected.2 >out.2
diff out.2 expected.2

# Test multi-line CSV fields.
cat >in.2b<<EOF
FGa, 0 1
GFa, 1 1
a U b, 1 1
"G(!r | Fa)
|
Fx", 0 1
EOF
run 0 ../../bin/ltl2tgba -C -Fin.2b/1 --stats='%f, %d %p' >out.2b
diff out.2b expected.2


run 0 ../../bin/ltl2tgba FGa GFa --stats='%f %d %n %s %p' >out.3
cat >expected.3<<EOF
FGa 0 1 2 0
GFa 1 0 1 1
EOF

diff out.3 expected.3


run 0 ../../bin/ltl2tgba -DC FGa GFa --stats='%f %d %n %s %p' >out.4
cat >expected.4<<EOF
FGa 0 1 3 1
GFa 1 0 1 1
EOF

diff out.4 expected.4

