2016-12-19 17:24:12 -05:00
|
|
|
(defun run-unit-test (unit-test)
|
2017-02-27 15:36:17 -05:00
|
|
|
(if (funcall unit-test)
|
2017-03-03 11:56:27 -05:00
|
|
|
(progn
|
|
|
|
(print (cons t unit-test))
|
|
|
|
t
|
|
|
|
)
|
|
|
|
(progn
|
|
|
|
(print (cons 'F unit-test))
|
|
|
|
nil
|
|
|
|
)
|
2016-12-19 17:24:12 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun run-test-suite (test-suite)
|
2017-02-27 15:36:17 -05:00
|
|
|
(if test-suite
|
2017-03-03 11:56:27 -05:00
|
|
|
(cons
|
|
|
|
(run-unit-test (car test-suite))
|
|
|
|
(run-test-suite (cdr test-suite))
|
2017-02-27 15:36:17 -05:00
|
|
|
)
|
2016-12-19 17:24:12 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun unit (test-suite)
|
2017-02-15 09:29:57 -05:00
|
|
|
(eval (cons 'and (run-test-suite test-suite)))
|
|
|
|
)
|
|
|
|
|
2017-03-03 11:56:27 -05:00
|
|
|
(defun assert (comparison expected actual)
|
|
|
|
(if (funcall comparison expected actual)
|
2017-02-27 15:36:17 -05:00
|
|
|
t
|
2017-03-03 11:56:27 -05:00
|
|
|
(progn
|
|
|
|
(print (list expected 'is 'not comparison actual))
|
|
|
|
nil
|
|
|
|
)
|
2017-02-15 09:29:57 -05:00
|
|
|
)
|
2016-12-19 17:24:12 -05:00
|
|
|
)
|
2017-03-03 11:56:27 -05:00
|
|
|
|
|
|
|
(defun assert= (expected actual)
|
|
|
|
(assert '= expected actual)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun assert-equal (expected actual)
|
|
|
|
(assert 'equal expected actual)
|
|
|
|
)
|
|
|
|
|