post-scarcity/unit-tests/recursion.sh
Simon Brooke 5a84f5e305 Fixed the eval-real test
So that it passes provided the answer is right to within one part in a million. Also worked on a solution to returning exceptions from make_stack_frame
2018-12-21 21:36:37 +00:00

22 lines
329 B
Bash

#!/bin/bash
expected='nil3628800'
actual=`target/psse 2>/dev/null <<EOF
(progn
(set! fact
(lambda (n)
(cond ((= n 1) 1)
(t (* n (fact (- n 1)))))))
nil)
(fact 10)
EOF`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '${expected}', got '${actual}'"
exit 1
fi