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 (defun test-fn (condition form)
13 (format t "Test `~S' passed~%" form)
14 (incf *passed-tests*))
16 (if *use-html-output-p*
17 (format t "<font color='red'>Test `~S' failed.</font>~%" form)
18 (format t "Test `~S' failed.~%" form))
19 (incf *failed-tests*)))
22 (defun expected-failure-fn (condition form)
25 (if *use-html-output-p*
26 (format t "<font color='orange'>Test `~S' passed unexpectedly!</font>~%" form)
27 (format t "Test `~S' passed unexpectedly!~%" form))
28 (incf *unexpected-passes*))
30 (format t "Test `~S' failed expectedly.~%" form)
31 (incf *expected-failures*)))
35 (defmacro test (condition)
36 `(test-fn ,condition ',condition))
38 (defmacro expected-failure (condition)
39 `(expected-failure-fn ,condition ',condition))
41 (defmacro test-equal (form value)
42 `(test (equal ,form, value)))
44 (setq *timestamp* (get-internal-real-time))