r5452: *** empty log message ***
[xlunit.git] / assert.lisp
index 460bb4d07a92cc1246a0a9913a2ff92ffb9f21e9..fa2f100e92a216cf3bec1e0a4872b301e8e564e6 100644 (file)
@@ -2,7 +2,7 @@
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
-;;;; ID:       $Id: assert.lisp,v 1.3 2003/08/04 12:28:46 kevin Exp $
+;;;; ID:       $Id: assert.lisp,v 1.4 2003/08/04 16:13:58 kevin Exp $
 ;;;; Purpose:  Assert functions for XLUnit
 ;;;;
 ;;;; *************************************************************************
 (in-package #:xlunit)
 
 
-;;; Assertions
-
-(define-condition test-failure-condition (simple-condition) 
+(define-condition assertion-failed (simple-condition) 
   ((msg :initform nil :initarg :msg :accessor msg))
   (:documentation "Base class for all test failures."))
 
 
 (defun failure-msg (msg &optional format-str &rest args)
   "Signal a test failure and exit the test."
-  (signal 'test-failure-condition
+  (signal 'assertion-failed
          :msg msg
          :format-control format-str
          :format-arguments args))
   "Signal a test failure and exit the test."
   (apply #'failure-msg nil format-str args))
 
-(defmacro test-assert (test &optional msg)
-  `(unless ,test
-    (failure-msg ,msg "Test assertion: ~s" ',test)))
-
 (defun assert-equal (v1 v2 &optional msg)
   (unless (equal v1 v2)
     (failure-msg msg "Test equal: ~S ~S" v1 v2)))
 
+(defun assert-eql (v1 v2 &optional msg)
+  (unless (eql v1 v2)
+    (failure-msg msg "Test eql: ~S ~S" v1 v2)))
+
 (defmacro assert-true (v &optional msg)
   `(unless ,v
     (failure-msg msg "Not true: ~S" ',v)))