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

. ./defs

set -e

cat >input1 <<EOF
HOA: v1
States: 4
Start: 0
AP: 2 "a" "b"
Acceptance: 0 t
properties: state-labels
--BODY--
State: [!1] 0
1
State: [0&1] 1
2
State: [0] 2
3 0
State: [1] 3
0
--END--
HOA: v1
States: 2
Start: 0
AP: 0
Acceptance: 0 t
properties: state-labels
--BODY--
State: [t] 0 0 1
State: [t] 1 0 1
--END--
HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
Acceptance: 0 t
properties: state-labels
--BODY--
State: [0&1] 0 0
--END--
HOA: v1
States: 6
Start: 0
AP: 0
Acceptance: 0 t
properties: state-labels
--BODY--
State: [t] 0
1 2 3 4 5
State: [f] 1
State: [f] 2
State: [f] 3
State: [f] 4
State: [f] 5
--END--
EOF

run 0 ../kripkecat input1 > input1.out
run 0 ../kripkecat input1.out > input1.out2


cat >input2 <<EOF
HOA: v1
States: 4
Start: 0
AP: 0
Acceptance: 0 t
properties: state-labels
--BODY--
State: [t] 0
1 2 3
--END--
HOA: v1
States: 2
Start: 0
AP: 0
Acceptance: 1 Fin(0)
properties: state-labels
--BODY--
State: [t] 0
0 1 {0}
State: 1
[t] 0 [f] 1
--END--
DRA v2 explicit
Comment: "Safra[NBA=2]"
States: 3
Acceptance-Pairs: 1
Start: 0
AP: 1 "a"
---
State: 0
Acc-Sig:
1
2
State: 1
Acc-Sig: -0
1
1
State: 2
Acc-Sig: +0
2
2
EOF

../kripkecat input2 2>output2.err && exit 1
cat output2.err
cat >expected2<<EOF
input2:9.1: state 1 has no definition
input2:9.3: state 2 has no definition
input2:9.5: state 3 has no definition
input2:15.13-20: the acceptance for Kripke structure must be '0 t'
input2:20.1-8: Kripke structures should have labeled states
input2:21.1-3: transition label used although the automaton was...
input2:16.13-24: ... declared with 'properties: state-labels' here
input2:23.1-3: cannot read a Kripke structure out of a DSTAR automaton
EOF

diff output2.err expected2
