This once again does NOT compile. I've done work on macros; they don't work yet..

This commit is contained in:
Simon Brooke 2026-03-30 21:49:08 +01:00
parent e3f922a8bf
commit 2b22780ccf
86 changed files with 279 additions and 153 deletions

104
unit-tests/bignum-print.sh Executable file
View file

@ -0,0 +1,104 @@
#!/bin/bash
return=0
#####################################################################
# large number, not actally a bignum
expected='576460752303423488'
output=`echo "(progn (print $expected) nil)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
sed 's/\,//g' |\
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
echo -n "$0 => printing $expected: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
fi
#####################################################################
# right on the boundary
expected='1152921504606846976'
output=`echo "(progn (print $expected) nil)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
sed 's/\,//g' |\
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
echo -n "$0 => printing $expected: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
fi
#####################################################################
# definitely a bignum
expected='1152921504606846977'
output=`echo "(progn (print $expected) nil)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
sed 's/\,//g' |\
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
echo -n "$0 => printing $expected: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
fi
# Currently failing from here on, but it's failing in read because of
# the multiply bug. We know printing blows up at the 3 cell boundary
# because `lisp/scratchpad2.lisp` constructs a 3 cell bignum by
# repeated addition.
#####################################################################
# Just on the three cell boundary
expected='1329227995784915872903807060280344576'
output=`echo "(progn (print $expected) nil)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
sed 's/\,//g' |\
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
echo -n "$0 => printing $expected: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', \n got '${actual}'"
return=1
fi
exit 0
#####################################################################
# definitely a three cell bignum
expected='1329227995784915872903807060280344577'
output=`echo "(progn (print $expected) nil)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
sed 's/\,//g' |\
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
echo -n "$0 => printing $expected: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
fi
exit ${return}