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 (defvar *timestamp* nil)
10 (defmacro test (condition)
14 (format t "Test `~S' passed~%" ',condition)
15 (incf *passed-tests*))
17 (if *use-html-output-p*
18 (format t "<font color='red'>Test `~S' failed.</font>~%" ',condition)
19 (format t "Test `~S' failed.~%" ',condition))
20 (incf *failed-tests*)))
21 (incf *total-tests*)))
23 (defmacro expected-failure (condition)
27 (if *use-html-output-p*
28 (format t "<font color='orange'>Test `~S' passed unexpectedly!</font>~%" ',condition)
29 (format t "Test `~S' passed unexpectedly!~%" ',condition))
30 (incf *unexpected-passes*))
32 (format t "Test `~S' failed failed expectedly.~%" ',condition)
33 (incf *expected-failures*)))
34 (incf *total-tests*)))
36 (defmacro test-equal (form value)
37 `(test (equal ,form, value)))
40 (format t "Running tests...~%~%")
41 (setq *timestamp* (get-internal-real-time))