Added more unit tests.
This commit is contained in:
parent
8026138b9c
commit
6eab3a531a
|
@ -29,7 +29,7 @@ void print( FILE* output, struct cons_pointer pointer) {
|
||||||
}
|
}
|
||||||
fputc( ')', output);
|
fputc( ')', output);
|
||||||
} else if ( check_tag( pointer, INTEGERTAG)) {
|
} else if ( check_tag( pointer, INTEGERTAG)) {
|
||||||
fprintf( output, " %ld", cell.payload.integer.value);
|
fprintf( output, "%ld", cell.payload.integer.value);
|
||||||
} else if ( check_tag( pointer, NILTAG)) {
|
} else if ( check_tag( pointer, NILTAG)) {
|
||||||
fprintf( output, "NIL");
|
fprintf( output, "NIL");
|
||||||
} else if ( check_tag( pointer, REALTAG)) {
|
} else if ( check_tag( pointer, REALTAG)) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ fail=0
|
||||||
|
|
||||||
for file in unit-tests/*
|
for file in unit-tests/*
|
||||||
do
|
do
|
||||||
echo ${file}
|
echo -n "${file} => "
|
||||||
bash ${file}
|
bash ${file}
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
|
|
@ -8,6 +8,6 @@ then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Expected '$expected', got '$actual'"
|
echo "Fail: expected '$expected', got '$actual'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
expected=\"Fred\"
|
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
|
then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Expected '$expected', got '$actual'"
|
echo "Fail: expected '$expected', got '$actual'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
14
unit-tests/integer-allocation.sh
Normal file
14
unit-tests/integer-allocation.sh
Normal 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
13
unit-tests/integer.sh
Normal 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
|
|
@ -8,6 +8,6 @@ then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Expected '${expected}', got '${actual}'"
|
echo "Fail: expected '${expected}', got '${actual}'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
13
unit-tests/simple-list.sh
Normal file
13
unit-tests/simple-list.sh
Normal 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
|
13
unit-tests/string-with-spaces.sh
Normal file
13
unit-tests/string-with-spaces.sh
Normal 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
|
Loading…
Reference in a new issue