X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests.lisp;h=4c741c643993ee7e57156f2ba418a8f32d3a34e3;hb=709d2737da56b9ecbd9598bab911e3feefdfb42c;hp=8c57af498d31942b4176fd1a440169fd6f18fab0;hpb=c8754d3b98508cf5e125bd07b819dcfc0c447c2a;p=jscl.git
diff --git a/tests.lisp b/tests.lisp
index 8c57af4..4c741c6 100644
--- a/tests.lisp
+++ b/tests.lisp
@@ -1,27 +1,22 @@
-(defvar *total-tests* 0)
-(defvar *passed-tests* 0)
-(defvar *failed-tests* 0)
-
-(defvar *expected-failures* 0)
-(defvar *unexpected-passes* 0)
+(defparameter *total-tests* 0)
+(defparameter *passed-tests* 0)
+(defparameter *failed-tests* 0)
+(defparameter *expected-failures* 0)
+(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 "")
- "Test `"
- ,(prin1-to-string condition)
- "' failed."
- (if-html "")))
+ (if *use-html-output-p*
+ (format t "Test `~S' failed.~%" ',condition)
+ (format t "Test `~S' failed.~%" ',condition))
(incf *failed-tests*)))
(incf *total-tests*)))
@@ -29,18 +24,18 @@
`(progn
(cond
(,condition
- (write-line (concat (if-html "")
- "Test `"
- ,(prin1-to-string condition)
- "' passed unexpectedly!"
- (if-html "")))
+ (if *use-html-output-p*
+ (format t "Test `~S' passed unexpectedly!~%" ',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))