post-scarcity/unit-tests/reverse.sh
Simon Brooke 222368bf64 Stage one clean up of test files. Some unit tests are still creating temporary files in
the project root directory, which is still to be fixed; and *I think* known-failing
tests which I don't intend to fix immediately should be marked in some way.
2026-02-14 14:04:41 +00:00

43 lines
1,012 B
Bash
Executable file

#!/bin/bash
result=0
echo -n "$0: reverse a string... "
expected='"god yzal eht revo depmuj xof nworb kciuq ehT"'
actual=`echo '(reverse "The quick brown fox jumped over the lazy dog")' | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: reverse a list... "
expected='(1,024 512 256 128 64 32 16 8 4 2)'
actual=`echo "(reverse '(2 4 8 16 32 64 128 256 512 1024))" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: reverse a symbol... "
expected='esrever'
actual=`echo "(reverse 'reverse)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
exit ${result}