Skip to content
Snippets Groups Projects
Commit f0d15813 authored by Jan Vesely's avatar Jan Vesely
Browse files

add test bash script for adeterminize

parent 39ae14b9
No related branches found
No related tags found
No related merge requests found
#!/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 testVpa
{
echo "VPA:"
echo " Tests not implemented yet."
}
function testRhdpda
{
echo "RHDPDA:"
echo " Tests not implemented yet."
}
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
testVpa
testRhdpda
printResults
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment