1 (defparameter *total-tests* 0)
2 (defparameter *passed-tests* 0)
3 (defparameter *failed-tests* 0)
4 (defparameter *expected-failures* 0)
5 (defparameter *unexpected-passes* 0)
7 (defvar *use-html-output-p* t)
8 (defun if-html (string) (if *use-html-output-p* string ""))
10 (defvar *timestamp* nil)
12 (defmacro test (condition)
16 (write-line ,(concat "Test `" (prin1-to-string condition) "' passed"))
17 (incf *passed-tests*))
19 (write-line (concat (if-html "<font color=red>")
21 ,(prin1-to-string condition)
24 (incf *failed-tests*)))
25 (incf *total-tests*)))
27 (defmacro expected-failure (condition)
31 (write-line (concat (if-html "<font color=orange>")
33 ,(prin1-to-string condition)
34 "' passed unexpectedly!"
36 (incf *unexpected-passes*))
38 (write-line ,(concat "Test `" (prin1-to-string condition) "' failed expectedly."))
39 (incf *expected-failures*)))
40 (incf *total-tests*)))
42 (write-line "Running tests...")
45 (setq *timestamp* (get-internal-real-time))