diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tailcall-big.lisp | 24 | ||||
| -rw-r--r-- | tests/tailcall.lisp | 7 | ||||
| -rw-r--r-- | tests/test.lisp | 17 |
3 files changed, 41 insertions, 7 deletions
diff --git a/tests/tailcall-big.lisp b/tests/tailcall-big.lisp new file mode 100644 index 0000000..ebf64c6 --- /dev/null +++ b/tests/tailcall-big.lisp @@ -0,0 +1,24 @@ +(assert (is-even 10000)) +(assert (cnt-down 10000)) + +;; can pass without stack overflow, +;; but comment out for too time-consuming +;; (assert (is-even 1000000)) +;; (assert (cnt-down 1000000)) + +(let ((my-evenp + (lambda (x) + (if (= x 0) + #t + (funcall my-oddp (- x 1))))) + (my-oddp + (lambda (x) + (if (= x 0) + #f + (funcall my-evenp (- x 1)))))) + (assert (funcall my-evenp 10000)) + (assert (funcall my-oddp 10009)) + (assert (not (funcall my-evenp 10009))) + (assert (not (funcall my-oddp 10000)))) + + diff --git a/tests/tailcall.lisp b/tests/tailcall.lisp index 86a88c8..1aa5e38 100644 --- a/tests/tailcall.lisp +++ b/tests/tailcall.lisp @@ -6,7 +6,6 @@ (defun is-odd (x) (is-even (- x 1))) -(assert (is-even 10000)) (assert (is-even 10)) (assert (is-even 0)) (assert (is-odd 1)) @@ -18,9 +17,3 @@ (progn (cnt-down (- x 1))))) -(assert (cnt-down 10000)) - -;; can pass without stack overflow, -;; but comment out for too time-consuming -;; (assert (is-even 1000000)) -;; (assert (cnt-down 1000000)) diff --git a/tests/test.lisp b/tests/test.lisp index ca8195c..26ba788 100644 --- a/tests/test.lisp +++ b/tests/test.lisp @@ -12,6 +12,23 @@ (test-module error) (test-module logic) (test-module tailcall) +(test-module tailcall-big) +(test-module control-flow) +(test-module lambda) +(test-module comment) +(test-module macro) +(test-module let-binding) + +(princ "\n\nTest with intensive GC:\n\n") +(_alwaysgc #t) + +(test-module math) +(test-module symbol) +(test-module eq) +(test-module arithmetic) +(test-module tailcall) +(test-module error) +(test-module logic) (test-module control-flow) (test-module lambda) (test-module comment) |
