Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
# -------------------- Constants --------------------
ADETERMINIZE_EXECUTABLE="adeterminize"
NFSM_TESTS_COUNT="4"
NIDPDA_TESTS_COUNT="3"
# -------------------- Functions --------------------
function checkAdeterminizeExecutable
{
if [ ! -f $ADETERMINIZE_EXECUTABLE ]; then
echo "Make sure $ADETERMINIZE_EXECUTABLE, which is necessary for running this test, exists in bin folder."
exit 1
fi
}
function compareTmpAutomatons
{
TMP=$(./adiff.automaton tmp1.xml tmp2.xml)
if [ $? == 0 ]; then
((SUCCESS_COUNT++))
echo " Test $1: successful"
else
((FAILED_COUNT++))
echo " Test $1: FAILED"
fi
rm tmp1.xml tmp2.xml
}
function testFsm
{
echo "FSM:"
for i in $(seq 1 $NFSM_TESTS_COUNT); do
NFSM="../examples/automaton/NFSM$i.xml"
DFSM="../examples/automaton/NFSM$i.DET.xml"
./adeterminize --type=fsm < $NFSM > tmp1.xml
cp $DFSM tmp2.xml
compareTmpAutomatons "NFSM$i"
done
}
function testIdpda
{
echo "IDPDA:"
for i in $(seq 1 $NIDPDA_TESTS_COUNT); do
NIDPDA="../examples/automaton/NIDPDA$i.xml"
DIDPDA="../examples/automaton/NIDPDA$i.DET.xml"
./adeterminize --type=idpda < $NIDPDA > tmp1.xml
cp $DIDPDA tmp2.xml
compareTmpAutomatons "IDPDA$i"
done
}
function printIntroduction
{
echo "adeterminize tests:"
echo "-------------------------"
}
function printResults
{
echo "-------------------------"
echo "Results: $SUCCESS_COUNT successful, $FAILED_COUNT failed"
}
# -------------------- Run test --------------------
SUCCESS_COUNT=0
FAILED_COUNT=0
cd bin
printIntroduction
checkAdeterminizeExecutable
testFsm
testIdpda
printResults