Disable Forbble REPL. Add Forbble-based tests
This commit is contained in:
parent
d4d1f27a63
commit
4974e87273
|
@ -157,18 +157,19 @@
|
||||||
; Math
|
; Math
|
||||||
(feval (: "sq" dup * $))
|
(feval (: "sq" dup * $))
|
||||||
; Gets next Fibonacci number from two on stack
|
; Gets next Fibonacci number from two on stack
|
||||||
(feval (: "fib" swap over + dup . $))
|
(feval (: "_f" swap over + $))
|
||||||
|
(feval (: "fib" _f dup . $))
|
||||||
|
|
||||||
; A simple REPL. Exits on 'q'
|
;; A simple REPL. Exits on 'q'
|
||||||
(def repl (fn (_) (
|
;(def repl (fn (_) (
|
||||||
(prn "forbble::> ")
|
; (prn "forbble::> ")
|
||||||
(def _inp (inp 0 0))
|
; (def _inp (inp 0 0))
|
||||||
(if (= "q" _inp) () (
|
; (if (= "q" _inp) () (
|
||||||
(def _str (+ "(feval (" _inp "))" ))
|
; (def _str (+ "(feval (" _inp "))" ))
|
||||||
(eval _str)
|
; (eval _str)
|
||||||
(pch 10)
|
; (pch 10)
|
||||||
(repl 0)
|
; (repl 0)
|
||||||
)))))
|
; )))))
|
||||||
|
;
|
||||||
; Run the REPL
|
;; Run the REPL
|
||||||
(repl 0)
|
;(repl 0)
|
||||||
|
|
|
@ -28,7 +28,7 @@ title() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pass() {
|
pass() {
|
||||||
echo -n "[1;32m✓"
|
echo -n "[1;32m✓[0m"
|
||||||
((TOTAL_PASSES++))
|
((TOTAL_PASSES++))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ fail() {
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
if $VALGRIND; then
|
if $VALGRIND; then
|
||||||
|
echo -ne "\n $1 "
|
||||||
local output=$($VALCOM ./pl "(loadfile \"examples/lib.pbl\") $2")
|
local output=$($VALCOM ./pl "(loadfile \"examples/lib.pbl\") $2")
|
||||||
else
|
else
|
||||||
local output=$(./pl "(loadfile \"examples/lib.pbl\") $2")
|
local output=$(./pl "(loadfile \"examples/lib.pbl\") $2")
|
||||||
|
@ -189,6 +190,11 @@ check "BasicOpEval" "(eval \"(+ 5 10)\")" "15"
|
||||||
check "MapFilter" "(eval \"(fil (< 50) (map sq (1 2 3 4 5 6 7 8 9 10 11 12)))\")" "( 64 81 100 121 144 )"
|
check "MapFilter" "(eval \"(fil (< 50) (map sq (1 2 3 4 5 6 7 8 9 10 11 12)))\")" "( 64 81 100 121 144 )"
|
||||||
endBlock
|
endBlock
|
||||||
|
|
||||||
|
title "Forbble"
|
||||||
|
check "BasicForbbleOp" "(loadfile 'examples/forbble.pbl') (feval (10 10 * .)) ''" "100"
|
||||||
|
check "FibForbble" "(loadfile 'examples/forbble.pbl') (feval (1 1 _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f _f .)) ''" "28657"
|
||||||
|
endBlock
|
||||||
|
|
||||||
# title "Environment"
|
# title "Environment"
|
||||||
# check "EnvStressTestEarly" "(def a 1)(def b 20)(def c 'yee')(def d 'yeehunnid')(def e 3) (a)" "1"
|
# check "EnvStressTestEarly" "(def a 1)(def b 20)(def c 'yee')(def d 'yeehunnid')(def e 3) (a)" "1"
|
||||||
# check "EnvStressTestLate" "(def a 1)(def b 2)(def c 3)(def d 4)(def e 5)(def f 6)(def n 40) (n)" "40"
|
# check "EnvStressTestLate" "(def a 1)(def b 2)(def c 3)(def d 4)(def e 5)(def f 6)(def n 40) (n)" "40"
|
||||||
|
|
Loading…
Reference in New Issue