Mainly unit tests. 39/45 currently pass; the failures are all in bignum arithmetic and in deallocation.
This commit is contained in:
parent
e41ae1aa8b
commit
e489d02069
21 changed files with 206 additions and 100 deletions
|
|
@ -102,7 +102,7 @@ void print_map( URL_FILE * output, struct cons_pointer map ) {
|
|||
print( output, hashmap_get( map, key ) );
|
||||
|
||||
if ( !nilp( c_cdr( ks ) ) ) {
|
||||
url_fputws( L" ", output );
|
||||
url_fputws( L", ", output );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ struct cons_pointer hashmap_put_all( struct cons_pointer mapp,
|
|||
assoc = c_cdr( assoc);
|
||||
}
|
||||
} else if (hashmapp( assoc)) {
|
||||
for (struct cons_pointer keys = hashmap_keys( mapp); !nilp( keys);
|
||||
for (struct cons_pointer keys = hashmap_keys( assoc); !nilp( keys);
|
||||
keys = c_cdr( keys)) {
|
||||
struct cons_pointer key = c_car( keys);
|
||||
hashmap_put( mapp, key, hashmap_get( assoc, key));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,58 @@
|
|||
# State of Play
|
||||
|
||||
## 20260203
|
||||
|
||||
I'm consciously avoiding the bignum issue for now. My current thinking is that if the C code only handles 64 bit integers, and bignums have to be done in Lisp code, that's perfectly fine with me.
|
||||
|
||||
### Hashmaps, assoc lists, and generalised key/value stores
|
||||
|
||||
I now have the oblist working as a hashmap, and also hybrid assoc lists which incorporate hashmaps working. I don't 100% have consistent methods for reading stores which may be plain old assoc lists, new hybrid assoc lists, or hashmaps working but it isn't far off. This also takes me streets further towards doing hierarchies of hashmaps, allowing my namespace idea to work — and hybrid assoc lists provide a very sound basis for building environment structures.
|
||||
|
||||
Currently all hashmaps are mutable, and my doctrine is that that is fixable when access control lists are actually implemented.
|
||||
|
||||
#### assoc
|
||||
|
||||
The function `(assoc store key) => value` should be the standard way of getting a value out of a store.
|
||||
|
||||
#### put!
|
||||
|
||||
The function `(put! store key value) => store` should become the standard way of setting a value in a store (of course, if the store is an assoc list or an immutable map, a new store will be returned which holds the additional key/value binding).
|
||||
|
||||
### State of unit tests
|
||||
|
||||
Currently:
|
||||
|
||||
> Tested 45, passed 39, failed 6
|
||||
|
||||
But the failures are as follows:
|
||||
```
|
||||
unit-tests/bignum-add.sh => checking a bignum was created: Fail
|
||||
unit-tests/bignum-add.sh => adding 1152921504606846977 to 1: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-add.sh => adding 1 to 1152921504606846977: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-add.sh => adding 1152921504606846977 to 1152921504606846977: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-add.sh => adding 10000000000000000000 to 10000000000000000000: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-add.sh => adding 1 to 1329227995784915872903807060280344576: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-add.sh => adding 1 to 3064991081731777716716694054300618367237478244367204352: Fail: expected 't', got 'nil'
|
||||
unit-tests/bignum-expt.sh => (expt 2 60): Fail: expected '1152921504606846976', got '1'
|
||||
unit-tests/bignum-expt.sh => (expt 2 61): Fail: expected '2305843009213693952', got '2'
|
||||
unit-tests/bignum-expt.sh => (expt 2 64): Fail: expected '18446744073709551616', got '16'
|
||||
unit-tests/bignum-expt.sh => (expt 2 65): Fail: expected '36893488147419103232', got '32'
|
||||
unit-tests/bignum-print.sh => printing 1152921504606846976: Fail: expected '1152921504606846976', got '1'
|
||||
unit-tests/bignum-print.sh => printing 1152921504606846977: Fail: expected '1152921504606846977', got '2'
|
||||
unit-tests/bignum-print.sh => printing 1329227995784915872903807060280344576: Fail: expected '1329227995784915872903807060280344576', \n got '1151321504605245376'
|
||||
unit-tests/bignum.sh => unit-tests/bignum.sh => Fail: expected '1,152,921,504,606,846,976', got '1'
|
||||
unit-tests/bignum-subtract.sh => unit-tests/bignum-subtract.sh => subtracting 1 from 1152921504606846976: Fail: expected '1152921504606846975', got '0'
|
||||
unit-tests/bignum-subtract.sh => subtracting 1 from 1152921504606846977: Fail: expected '1152921504606846976', got '1'
|
||||
unit-tests/bignum-subtract.sh => subtracting 1 from 1152921504606846978: Fail: expected '1152921504606846977', got '2'
|
||||
unit-tests/bignum-subtract.sh => subtracting 1152921504606846977 from 1: Fail: expected '-1152921504606846976', got '1'
|
||||
unit-tests/bignum-subtract.sh => subtracting 10000000000000000000 from 20000000000000000000: Fail: expected '10000000000000000000', got '-376293541461622793'
|
||||
unit-tests/memory.sh
|
||||
```
|
||||
|
||||
In other words, all failures are in bignum arithmetic **except** that I still have a major memory leak due to not decrefing somewhere where I ought to.
|
||||
|
||||
### Zig
|
||||
|
||||
## 20250704
|
||||
|
||||
Right, I'm getting second and subsequent integer cells with negative values, which should not happen. This is probably the cause of (at least some of) the bignum problems. I need to find out why. This is (probably) fixable.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
return=0
|
||||
|
||||
#####################################################################
|
||||
# add two large numbers, not actally bignums to produce a smallnum
|
||||
# (right on the boundary)
|
||||
|
|
@ -12,13 +14,13 @@ output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
|
|||
actual=`echo $output |\
|
||||
tail -1`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking no bignum was created: "
|
||||
|
|
@ -28,7 +30,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -44,23 +46,23 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
echo -n "$0 => checking a bignum was created: "
|
||||
grep 'BIGNUM!' psse.log > /dev/null
|
||||
if [ $? -eq "0" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -77,28 +79,29 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
echo -n "$0 => checking a bignum was created: "
|
||||
grep 'BIGNUM!' psse.log > /dev/null
|
||||
if [ $? -eq "0" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
# add a smallnum and a bignum to produce a bignum
|
||||
# (just over the boundary)
|
||||
|
||||
a=1
|
||||
b=1152921504606846977
|
||||
c=`echo "$a + $b" | bc`
|
||||
|
|
@ -109,13 +112,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
|
|
@ -125,7 +128,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -134,7 +137,7 @@ fi
|
|||
|
||||
a=1152921504606846977
|
||||
c=`echo "$a + $a" | bc`
|
||||
echo -n "adding $a to $a: "
|
||||
echo -n "$0 => adding $a to $a: "
|
||||
expected='t'
|
||||
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
|
||||
|
||||
|
|
@ -147,7 +150,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -155,7 +158,7 @@ fi
|
|||
|
||||
a=1152921504606846977
|
||||
c=`echo "$a * 5" | bc`
|
||||
echo -n "adding $a, $a $a, $a, $a: "
|
||||
echo -n "$0 => adding $a, $a $a, $a, $a: "
|
||||
expected='t'
|
||||
output=`echo "(= (+ $a $a $a $a $a) $c)" | target/psse -v 2 2>psse.log`
|
||||
|
||||
|
|
@ -168,7 +171,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -186,23 +189,23 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
echo -n "$0 => checking a bignum was created: "
|
||||
grep 'BIGNUM!' psse.log > /dev/null
|
||||
if [ $? -eq "0" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -219,23 +222,23 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
echo -n "$0 => checking a bignum was created: "
|
||||
grep 'BIGNUM!' psse.log > /dev/null
|
||||
if [ $? -eq "0" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -253,21 +256,23 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "adding $a to $b: "
|
||||
echo -n "$0 => adding $a to $b: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking a bignum was created: "
|
||||
echo -n "$0 => checking a bignum was created: "
|
||||
grep 'BIGNUM!' psse.log > /dev/null
|
||||
if [ $? -eq "0" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
exit ${return}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
return=0
|
||||
|
||||
#####################################################################
|
||||
# last 'smallnum' value:
|
||||
# sbcl calculates (expt 2 59) => 576460752303423488
|
||||
|
|
@ -18,13 +20,13 @@ EOF`
|
|||
|
||||
actual=`echo "$output" | tail -1 | sed 's/\,//g'`
|
||||
|
||||
echo -n "(expt 2 59): "
|
||||
echo -n "$0 => (expt 2 59): "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -45,13 +47,13 @@ EOF`
|
|||
|
||||
actual=`echo "$output" | tail -1 | sed 's/\,//g'`
|
||||
|
||||
echo -n "(expt 2 60): "
|
||||
echo -n "$0 => (expt 2 60): "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -72,13 +74,13 @@ EOF`
|
|||
|
||||
actual=`echo "$output" | tail -1 | sed 's/\,//g'`
|
||||
|
||||
echo -n "(expt 2 61): "
|
||||
echo -n "$0 => (expt 2 61): "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -99,13 +101,13 @@ EOF`
|
|||
|
||||
actual=`echo "$output" | tail -1 | sed 's/\,//g'`
|
||||
|
||||
echo -n "(expt 2 64): "
|
||||
echo -n "$0 => (expt 2 64): "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
# sbcl calculates (expt 2 65) => 36893488147419103232
|
||||
|
|
@ -124,12 +126,13 @@ EOF`
|
|||
|
||||
actual=`echo "$output" | tail -1 | sed 's/\,//g'`
|
||||
|
||||
echo -n "(expt 2 65): "
|
||||
echo -n "$0 => (expt 2 65): "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
exit ${return}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
return=0
|
||||
|
||||
#####################################################################
|
||||
# large number, not actally a bignum
|
||||
expected='576460752303423488'
|
||||
|
|
@ -9,13 +11,13 @@ actual=`echo $output |\
|
|||
sed 's/\,//g' |\
|
||||
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
|
||||
|
||||
echo -n "printing $expected: "
|
||||
echo -n "$0 => printing $expected: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -28,13 +30,13 @@ actual=`echo $output |\
|
|||
sed 's/\,//g' |\
|
||||
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
|
||||
|
||||
echo -n "printing $expected: "
|
||||
echo -n "$0 => printing $expected: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -47,13 +49,13 @@ actual=`echo $output |\
|
|||
sed 's/\,//g' |\
|
||||
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
|
||||
|
||||
echo -n "printing $expected: "
|
||||
echo -n "$0 => printing $expected: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -70,13 +72,13 @@ actual=`echo $output |\
|
|||
sed 's/\,//g' |\
|
||||
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
|
||||
|
||||
echo -n "printing $expected: "
|
||||
echo -n "$0 => printing $expected: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', \n got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -90,13 +92,13 @@ actual=`echo $output |\
|
|||
sed 's/\,//g' |\
|
||||
sed 's/[^0-9]*\([0-9]*\).*/\1/'`
|
||||
|
||||
echo -n "printing $expected: "
|
||||
echo -n "$0 => printing $expected: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit ${return}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
return=0
|
||||
|
||||
#####################################################################
|
||||
# subtract a smallnum from a smallnum to produce a smallnum
|
||||
# (right on the boundary)
|
||||
|
|
@ -12,13 +14,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "subtracting $b from $a: "
|
||||
echo -n "$0 => subtracting $b from $a: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
echo -n "checking no bignum was created: "
|
||||
|
|
@ -28,7 +30,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -43,13 +45,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "subtracting $b from $a: "
|
||||
echo -n "$0 => subtracting $b from $a: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -63,13 +65,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "subtracting $b from $a: "
|
||||
echo -n "$0 => subtracting $b from $a: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -85,13 +87,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "subtracting $b from $a: "
|
||||
echo -n "$0 => subtracting $b from $a: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -105,12 +107,13 @@ actual=`echo $output |\
|
|||
tail -1 |\
|
||||
sed 's/\,//g'`
|
||||
|
||||
echo -n "subtracting $b from $a: "
|
||||
echo -n "$0 => subtracting $b from $a: "
|
||||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
return=1
|
||||
fi
|
||||
|
||||
exit ${return}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
return=0
|
||||
|
||||
expected='1,152,921,504,606,846,976'
|
||||
# 1,152,921,504,606,846,975 is the largest single cell positive integer;
|
||||
# consequently 1,152,921,504,606,846,976 is the first two cell positive integer.
|
||||
|
|
@ -9,6 +11,8 @@ if [ "${expected}" = "${actual}" ]
|
|||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
echo "$0 => Fail: expected '${expected}', got '${actual}'"
|
||||
return=1
|
||||
fi
|
||||
|
||||
exit ${return}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected='5'
|
||||
actual=`echo "(cond ((equal 2 2) 5))" | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='"should"'
|
||||
|
|
@ -17,8 +19,9 @@ actual=`echo "(cond ((equal 2 3) \"shouldn't\")(t \"should\"))" | target/psse |
|
|||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected='11'
|
||||
actual=`echo "(let ((a . 5)(b . 6)) (+ a b))" | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='1'
|
||||
|
|
@ -17,8 +19,9 @@ actual=`echo "(let ((a . 5)(b . 6)) (+ a b) (- b a))" | target/psse | tail -1`
|
|||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected="(0 1 2 3 4 5 6 7 8 9 a b c d e f)"
|
||||
|
||||
actual=`echo "(list 0 1 2 3 4 5 6 7 8 9 'a 'b 'c 'd 'e 'f)" | target/psse | tail -1`
|
||||
|
|
@ -9,7 +11,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected="(0 1 2 3 4)"
|
||||
|
|
@ -21,7 +23,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected="(0 1 2 3 4 5 6 7)"
|
||||
|
|
@ -34,5 +36,7 @@ then
|
|||
exit 0
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=1
|
||||
|
||||
expected="120"
|
||||
actual=`echo "(+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)" | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
# check that all the args are actually being evaluated...
|
||||
|
|
@ -20,5 +22,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
return ${result}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
#####################################################################
|
||||
# Create an empty map using map notation
|
||||
expected='{}'
|
||||
|
|
@ -11,7 +13,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -25,7 +27,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -41,7 +43,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -57,7 +59,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -71,7 +73,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -86,5 +88,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected='6'
|
||||
actual=`echo "(multiply 2 3)" | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='7.5'
|
||||
|
|
@ -17,8 +19,9 @@ actual=`echo "(multiply 2.5 3)" | target/psse | tail -1`
|
|||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
#####################################################################
|
||||
# Create a path from root using compact path notation
|
||||
expected='(-> oblist :users :simon :functions (quote assoc))'
|
||||
|
|
@ -11,7 +13,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
#####################################################################
|
||||
|
|
@ -25,7 +27,8 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected='5'
|
||||
actual=`echo "(progn (add 2 3))" | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='"foo"'
|
||||
|
|
@ -17,8 +19,9 @@ actual=`echo "(progn (add 2.5 3) \"foo\")" | target/psse | tail -1`
|
|||
if [ "${expected}" = "${actual}" ]
|
||||
then
|
||||
echo "OK"
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
expected='"god yzal eht revo depmuj xof nworb kciuq ehT"'
|
||||
actual=`echo '(reverse "The quick brown fox jumped over the lazy dog")' | target/psse | tail -1`
|
||||
|
||||
|
|
@ -8,7 +10,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='(1,024 512 256 128 64 32 16 8 4 2)'
|
||||
|
|
@ -19,7 +21,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
expected='esrever'
|
||||
|
|
@ -31,6 +33,8 @@ then
|
|||
exit 0
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
echo ${result}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ then
|
|||
rm ${tmp}
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '$expected', got '$actual'"
|
||||
echo "$0 => Fail: expected '$expected', got '$actual'"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ then
|
|||
echo "OK"
|
||||
exit 0
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
echo "$0 => Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=0
|
||||
|
||||
# We should be able to cons a single character string onto the front of a string
|
||||
expected='"Test"'
|
||||
actual=`echo '(cons "T" "est")' | target/psse | tail -1`
|
||||
|
|
@ -9,7 +11,7 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
# But if the first argument has more than one character, we should get a dotted pair
|
||||
|
|
@ -21,5 +23,8 @@ then
|
|||
echo "OK"
|
||||
else
|
||||
echo "Fail: expected '${expected}', got '${actual}'"
|
||||
exit 1
|
||||
result=1
|
||||
fi
|
||||
|
||||
exit ${result}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue