Moved legacy code into archive, ready for a new rapid(?) prototype.

I may regret doing this!
This commit is contained in:
Simon Brooke 2026-03-24 16:25:09 +00:00
parent 09051a3e63
commit 914c35ead0
114 changed files with 165 additions and 1 deletions

View file

@ -0,0 +1,119 @@
#!/bin/bash
result=0
#####################################################################
# subtract a smallnum from a smallnum to produce a smallnum
# (right on the boundary)
a=1152921504606846976
b=1
expected='1152921504606846975'
output=`echo "(- $a $b)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
tail -1 |\
sed 's/\,//g'`
echo -n "$0 => subtracting $b from $a: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
echo -n "$0 => checking no bignum was created: "
grep -v 'BIGNUM!' psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
else
echo "Fail"
result=`echo "${result} + 1" | bc`
fi
#####################################################################
# subtract a smallnum from a bignum to produce a smallnum
# (just over the boundary)
a='1152921504606846977'
b=1
expected='1152921504606846976'
output=`echo "(- $a $b)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
tail -1 |\
sed 's/\,//g'`
echo -n "$0 => subtracting $b from $a: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
#####################################################################
# subtract a smallnum from a bignum to produce a smallnum
a='1152921504606846978'
b=1
expected='1152921504606846977'
output=`echo "(- $a $b)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
tail -1 |\
sed 's/\,//g'`
echo -n "$0 => subtracting $b from $a: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
#####################################################################
# subtract a bignum from a smallnum to produce a negstive smallnum
# (just over the boundary)
a=1
b=1152921504606846977
expected='-1152921504606846976'
output=`echo "(- $a $b)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
tail -1 |\
sed 's/\,//g'`
echo -n "$0 => subtracting $b from $a: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
#####################################################################
# subtract a bignum from a bignum to produce a bignum
a=20000000000000000000
b=10000000000000000000
expected=10000000000000000000
output=`echo "(- $a $b)" | target/psse -v 2 2>psse.log`
actual=`echo $output |\
tail -1 |\
sed 's/\,//g'`
echo -n "$0 => subtracting $b from $a: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=`echo "${result} + 1" | bc`
fi
exit ${result}