1 (defvar *total-tests* 0)
2 (defvar *passed-tests* 0)
3 (defvar *failed-tests* 0)
5 (defvar *expected-failures* 0)
6 (defvar *unexpected-passes* 0)
8 (defvar *use-html-output-p* t)
9 (defun if-html (string) (if *use-html-output-p* string ""))
11 (defvar *timestamp* nil)
13 (defmacro test (condition)
17 (write-line ,(concat "Test `" (prin1-to-string condition) "' passed"))
18 (incf *passed-tests*))
20 (write-line (concat (if-html "<font color=red>")
22 ,(prin1-to-string condition)
25 (incf *failed-tests*)))
26 (incf *total-tests*)))
28 (defmacro expected-failure (condition)
32 (write-line (concat (if-html "<font color=orange>")
34 ,(prin1-to-string condition)
35 "' passed unexpectedly!"
37 (incf *unexpected-passes*))
39 (write-line ,(concat "Test `" (prin1-to-string condition) "' failed expectedly."))
40 (incf *expected-failures*)))
41 (incf *total-tests*)))
43 (write-line "Running tests...")
46 (setq *timestamp* (get-internal-real-time))