diff options
Diffstat (limited to 'tests/lisp')
| -rw-r--r-- | tests/lisp/arithmetic.lisp | 12 | ||||
| -rw-r--r-- | tests/lisp/comment.lisp | 8 | ||||
| -rw-r--r-- | tests/lisp/control-flow.lisp | 36 | ||||
| -rw-r--r-- | tests/lisp/lambda.lisp | 12 | ||||
| -rw-r--r-- | tests/lisp/let-binding.lisp | 7 | ||||
| -rw-r--r-- | tests/lisp/macro.lisp | 10 | ||||
| -rw-r--r-- | tests/lisp/test.lisp | 14 |
7 files changed, 0 insertions, 99 deletions
diff --git a/tests/lisp/arithmetic.lisp b/tests/lisp/arithmetic.lisp deleted file mode 100644 index 2764b10..0000000 --- a/tests/lisp/arithmetic.lisp +++ /dev/null @@ -1,12 +0,0 @@ -(assert (= 1 (+ 1 0))) -(assert (= -1 (- 0 1))) -(assert (= -1 (- 1))) -(assert (= 1.1 (+ 1 0.1))) -(assert (= 2 (i/ 11 5))) -(assert (= 1 (mod 11 5))) - -(assert-error (+ 1 "a")) -(assert-error (- 1 "a")) -(assert-error (* 1 "a")) -(assert-error (/ 1 "a")) - diff --git a/tests/lisp/comment.lisp b/tests/lisp/comment.lisp deleted file mode 100644 index 40d5081..0000000 --- a/tests/lisp/comment.lisp +++ /dev/null @@ -1,8 +0,0 @@ -(list 1 2 3) ;; comment -(list 1;; comment - 2 3) -(list 1 ;; comment -;; comment - 2 3) -;; comment - diff --git a/tests/lisp/control-flow.lisp b/tests/lisp/control-flow.lisp deleted file mode 100644 index 75095ec..0000000 --- a/tests/lisp/control-flow.lisp +++ /dev/null @@ -1,36 +0,0 @@ -(assert-error (if (error "") 1 2)) - -(defmacro inmacro x (progn ,@x)) - -(let ((i 0)) - (while #t - (if (> i 4) - (break) - nil) - (incq i)) - (assert (= i 5))) - -(let ((i 0)) - (while #t - (if (> i 4) - (let () (break)) - nil) - (incq i)) - (assert (= i 5))) - -(let ((flag 0) - (i 0)) - (while (< i 10) - (incq i) - (continue) - (setq flag 1)) - (assert (= i 10)) - (assert (= flag 0))) - -(assert-error (funcall (lambda () (break)))) -(assert-error (funcall (lambda () (continue)))) -(assert (= 1 (funcall (lambda () (return 1))))) -(assert (= 1 (funcall (lambda () (inmacro (return 1) (return 2)))))) -(assert (= 1 (funcall (lambda () (while #t (return 1)))))) -(assert (= 1 (funcall (lambda () (let () (return 1)))))) -(assert (= 1 (funcall (lambda () (let ((x (return 1))) (return 2)))))) diff --git a/tests/lisp/lambda.lisp b/tests/lisp/lambda.lisp deleted file mode 100644 index 5c93bdb..0000000 --- a/tests/lisp/lambda.lisp +++ /dev/null @@ -1,12 +0,0 @@ -(defun Y (f) - (funcall - (lambda (g) (funcall g g)) - (lambda (h) - (funcall f (lambda args (apply (funcall h h) args)))))) -(defun fibo-impl (self) - (lambda (n) - (if (<= n 2) - 1 - (+ (funcall self (- n 1)) (funcall self (- n 2)))))) -(defvar fibo (Y #'fibo-impl)) -(assert (= 55 (funcall fibo 10))) diff --git a/tests/lisp/let-binding.lisp b/tests/lisp/let-binding.lisp deleted file mode 100644 index 33d021e..0000000 --- a/tests/lisp/let-binding.lisp +++ /dev/null @@ -1,7 +0,0 @@ -(assert-error (let ((i 0)) (i > 4))) - -(assert (= 3 -(let ((a 1) - (b 2)) - (+ a b)))) - diff --git a/tests/lisp/macro.lisp b/tests/lisp/macro.lisp deleted file mode 100644 index 4564cb9..0000000 --- a/tests/lisp/macro.lisp +++ /dev/null @@ -1,10 +0,0 @@ -(defmacro for (start pred inc . body) - `(let (,start) - (while ,pred - ,@body - ,inc))) -(assert (= 10 - (let ((sum 0)) - (for (i 0) (< i 5) (incq i) - (setq sum (+ sum i))) - sum))) diff --git a/tests/lisp/test.lisp b/tests/lisp/test.lisp deleted file mode 100644 index 07bdd5b..0000000 --- a/tests/lisp/test.lisp +++ /dev/null @@ -1,14 +0,0 @@ -(defmacro test-module (name) - `(progn - (princ (format "[TEST] %s\n" ,name)) - (load (format "%s.lisp" ,name)) - (princ (format "[PASS] %s\n" ,name)))) - -(test-module "arithmetic") -(test-module "control-flow") -(test-module "lambda") -(test-module "comment") -(test-module "macro") -(test-module "let-binding") - -(exit) |
