Added more unit tests.

This commit is contained in:
Simon Brooke 2017-01-07 11:13:06 +00:00
parent 8026138b9c
commit 6eab3a531a
9 changed files with 60 additions and 7 deletions

View file

@ -13,7 +13,7 @@ fail=0
for file in unit-tests/*
do
echo ${file}
echo -n "${file} => "
bash ${file}
if [ $? -eq 0 ]

View file

@ -8,6 +8,6 @@ then
echo "OK"
exit 0
else
echo "Expected '$expected', got '$actual'"
echo "Fail: expected '$expected', got '$actual'"
exit 1
fi

View file

@ -1,13 +1,13 @@
#!/bin/bash
expected=\"Fred\"
actual=`echo '"Fred"' | target/psse 2> /dev/null`
actual=`echo ${expected} | target/psse 2> /dev/null`
if [ "$expected" = "$actual" ]
if [ "${expected}" = "{$actual}" ]
then
echo "OK"
exit 0
else
echo "Expected '$expected', got '$actual'"
echo "Fail: expected '$expected', got '$actual'"
exit 1
fi

View file

@ -0,0 +1,14 @@
#!/bin/bash
value=354
expected="Integer cell: value ${value}"
echo ${value} | target/psse 2>&1 | grep "${expected}" > /dev/null
if [ $? -eq 0 ]
then
echo "OK"
exit 0
else
echo "Expected '${expected}', not found"
exit 1
fi

13
unit-tests/integer.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash
expected="354"
actual=`echo ${expected} | target/psse 2> /dev/null`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Expected '${expected}', got '${actual}'"
exit 1
fi

View file

@ -8,6 +8,6 @@ then
echo "OK"
exit 0
else
echo "Expected '${expected}', got '${actual}'"
echo "Fail: expected '${expected}', got '${actual}'"
exit 1
fi

13
unit-tests/simple-list.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/bash
expected="(1 2 3)"
actual=`echo '(1 2 3)' | target/psse 2> /dev/null`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '${expected}', got '${actual}'"
exit 1
fi

View file

@ -0,0 +1,13 @@
#!/bin/bash
expected="\"Strings should be able to include spaces (and other stuff)!\""
actual=`echo ${expected} | target/psse 2> /dev/null`
if [ "${expected}" = "{$actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '$expected', got '$actual'"
exit 1
fi