24 lines
488 B
Common Lisp
24 lines
488 B
Common Lisp
(defun run-unit-test (unit-test)
|
|
(cond
|
|
((funcall unit-test) (print (cons T unit-test)) T)
|
|
(T (print (cons 'F unit-test)) NIL)
|
|
)
|
|
)
|
|
|
|
(defun run-test-suite (test-suite)
|
|
(cond
|
|
(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)
|
|
(cond
|
|
((= expected actual) T)
|
|
(T (print (list expected 'is 'not actual)) nil)
|
|
)
|
|
)
|