X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests.lisp;h=4c741c643993ee7e57156f2ba418a8f32d3a34e3;hb=f8e5f4e8ae9b7bdc7efc7382a26aa6e28f6c4652;hp=b230068c023f96093ab1aab012bbd0b0b6b1da81;hpb=ad091133b3c6e27c105f6631076cb408df386d42;p=jscl.git
diff --git a/tests.lisp b/tests.lisp
index b230068..4c741c6 100644
--- a/tests.lisp
+++ b/tests.lisp
@@ -1,15 +1,41 @@
-(defvar *passed-tets* 0)
-(defvar *failed-tets* 0)
-(defvar *timestamp* (get-internal-real-time))
+(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)
+(defvar *timestamp* nil)
(defmacro test (condition)
- `(cond
- (,condition
- (write-line ,(concat "Test `" (prin1-to-string condition) "' passed"))
- (incf *passed-tets*))
- (t
- (write-line ,(concat "Test `" (prin1-to-string condition) "' failed."))
- (incf *failed-tets*))))
-
-(write-line "Running tests...")
-(write-line "")
+ `(progn
+ (cond
+ (,condition
+ (format t "Test `~S' passed~%" ',condition)
+ (incf *passed-tests*))
+ (t
+ (if *use-html-output-p*
+ (format t "Test `~S' failed.~%" ',condition)
+ (format t "Test `~S' failed.~%" ',condition))
+ (incf *failed-tests*)))
+ (incf *total-tests*)))
+
+(defmacro expected-failure (condition)
+ `(progn
+ (cond
+ (,condition
+ (if *use-html-output-p*
+ (format t "Test `~S' passed unexpectedly!~%" ',condition)
+ (format t "Test `~S' passed unexpectedly!~%" ',condition))
+ (incf *unexpected-passes*))
+ (t
+ (format t "Test `~S' failed failed expectedly.~%" ',condition)
+ (incf *expected-failures*)))
+ (incf *total-tests*)))
+
+(defmacro test-equal (form value)
+ `(test (equal ,form, value)))
+
+
+(format t "Running tests...~%~%")
+(setq *timestamp* (get-internal-real-time))