Test display and code style tweaks
This commit is contained in:
parent
2af48f63ca
commit
c9babe439d
|
@ -8,7 +8,7 @@ SCRIPTDIR ?= /usr/local/share/pebblisp
|
|||
GCC_COM ?= gcc -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\"
|
||||
|
||||
all:
|
||||
$(GCC_COM) $(files) && ./tests.sh
|
||||
$(GCC_COM) $(files) && echo; ./tests.sh
|
||||
|
||||
notest:
|
||||
$(GCC_COM) $(files)
|
||||
|
|
13
src/tests.sh
13
src/tests.sh
|
@ -40,7 +40,6 @@ fail() {
|
|||
}
|
||||
|
||||
check() {
|
||||
local output
|
||||
if $VALGRIND; then
|
||||
local output=$($VALCOM ./pl "(loadfile \"examples/lib.pbl\") $2")
|
||||
else
|
||||
|
@ -56,7 +55,6 @@ check() {
|
|||
}
|
||||
|
||||
echo "[1;33mSTARTING TESTS[0;m"
|
||||
echo ""
|
||||
|
||||
title "Plain returns"
|
||||
check "PlainRet" "10" "10"
|
||||
|
@ -84,11 +82,16 @@ check "LessThan" "(< 23847123 19375933)" "F"
|
|||
check "Equality" "(= 987654321 987654321 )" "T"
|
||||
check "StringEquality" "(= \"Bean\" \"Bean\" )" "T"
|
||||
check "StringInequality" "(= \"Beans\" \"Bean\" )" "F"
|
||||
check "NullInequality" "(= \"Beans\" \"\" )" "F"
|
||||
endBlock
|
||||
|
||||
title "TypeCheck"
|
||||
check "IsNum" "(isnum 23847123)" "T"
|
||||
check "IsntNum" "(isnum \"WORDS\")" "F"
|
||||
check "IsString" "(isstr 'words')" "T"
|
||||
check "IsStringEmpty" "(isstr '')" "T"
|
||||
check "NumNotString" "(isstr 5)" "F"
|
||||
check "ListNotString" "(isstr ('hello'))" "F"
|
||||
endBlock
|
||||
|
||||
title "Ifs/Bools"
|
||||
|
@ -132,13 +135,15 @@ endBlock
|
|||
title "Lambdas"
|
||||
check "MultStmt" "(def yee (fn (a) (* 10 a))) ; (yee 5)" "50"
|
||||
check "DefinMap" "(def yee (fn (a) (* 10 a))) ; (map yee (5 10 2 (+ 12 0)))" "( 50 100 20 120 )"
|
||||
check "FbnciSeq" "(def fib (fn (a) \
|
||||
check "FbnciSeq" "\
|
||||
(def fib (fn (a) \
|
||||
(if (< a 2) \
|
||||
a \
|
||||
(+ (fib (- a 1)) (fib (- a 2))) \
|
||||
)));\
|
||||
(fib 20)" "6765"
|
||||
check "Factorial" "(def fac (fn (a) \
|
||||
check "Factorial" "\
|
||||
(def fac (fn (a) \
|
||||
(if (= a 1) \
|
||||
1 \
|
||||
(* a (fac (- a 1)) ) \
|
||||
|
|
Loading…
Reference in New Issue