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
This commit is contained in:
parent
7cd2cbf785
commit
5a84f5e305
6 changed files with 52 additions and 20 deletions
|
|
@ -8,10 +8,15 @@ actual=`echo "(eval 5.05)" |\
|
|||
head -2 |\
|
||||
tail -1`
|
||||
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
outcome=`echo "sqrt((${expected} - ${actual})^2) < 0.0000001" | bc`
|
||||
|
||||
|
||||
if [ "${outcome}" = "1" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
21
unit-tests/recursion.sh
Normal file
21
unit-tests/recursion.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue