transcendental-lisp/lisp/unit-test.lisp

26 lines
507 B
Common Lisp

(defun run-unit-test (unit-test)
(if (funcall unit-test)
(progn (print (cons t unit-test)) t)
(progn (print (cons 'F unit-test)) nil)
)
)
(defun run-test-suite (test-suite)
(if test-suite
(cons (run-unit-test (car test-suite))
(run-test-suite (cdr test-suite))
)
)
)
(defun unit (test-suite)
(eval (cons 'and (run-test-suite test-suite)))
)
(defun assert= (expected actual)
(if (= expected actual)
t
(progn (print (list expected 'is 'not actual)) nil)
)
)