(defparameter *unexpected-passes* 0)
(defvar *use-html-output-p* t)
-(defun if-html (string) (if *use-html-output-p* string ""))
-
(defvar *timestamp* nil)
(defmacro test (condition)
`(progn
(cond
(,condition
- (write-line ,(concat "Test `" (prin1-to-string condition) "' passed"))
+ (format t "Test `~S' passed~%" ',condition)
(incf *passed-tests*))
(t
- (write-line (concat (if-html "<font color=red>")
- "Test `"
- ,(prin1-to-string condition)
- "' failed."
- (if-html "</font>")))
+ (if *use-html-output-p*
+ (format t "<font color='red'>Test `~S' failed.</font>~%" ',condition)
+ (format t "Test `~S' failed.~%" ',condition))
(incf *failed-tests*)))
(incf *total-tests*)))
`(progn
(cond
(,condition
- (write-line (concat (if-html "<font color=orange>")
- "Test `"
- ,(prin1-to-string condition)
- "' passed unexpectedly!"
- (if-html "</font>")))
+ (if *use-html-output-p*
+ (format t "<font color='orange'>Test `~S' passed unexpectedly!</font>~%" ',condition)
+ (format t "Test `~S' passed unexpectedly!~%" ',condition))
(incf *unexpected-passes*))
(t
- (write-line ,(concat "Test `" (prin1-to-string condition) "' failed expectedly."))
+ (format t "Test `~S' failed failed expectedly.~%" ',condition)
(incf *expected-failures*)))
(incf *total-tests*)))
-(write-line "Running tests...")
-(write-line "")
+(defmacro test-equal (form value)
+ `(test (equal ,form, value)))
+
+(format t "Running tests...~%~%")
(setq *timestamp* (get-internal-real-time))