--- /dev/null
+;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;; *************************************************************************
+;;;; FILE IDENTIFICATION
+;;;;
+;;;; Name: assert.lisp
+;;;; Purpose: Assert functions for XLUnit
+;;;; Author: Kevin Rosenberg
+;;;;
+;;;; $Id: assert.lisp,v 1.1 2003/08/04 12:01:54 kevin Exp $
+;;;; *************************************************************************
+
+(in-package #:xlunit)
+
+
+;;; Assertions
+
+(define-condition test-failure-condition (simple-condition)
+ ((msg :initform nil :initarg :msg :accessor msg))
+ (:documentation "Base class for all test failures."))
+
+
+(defun failure (format-str &rest args)
+ "Signal a test failure and exit the test."
+ (signal 'test-failure-condition
+ :format-control format-str
+ :format-arguments args))
+
+(defmacro test-assert (test &optional msg)
+ `(unless ,test
+ (failure "Test assertion: ~s" ',test)))
+
+(defun assert-equal (v1 v2 &optional msg)
+ (unless (equal v1 v2)
+ (failure "Test equal: ~s ~s" v1 v2)))
+
+(defun assert-true (v &optional msg)
+ (unless v
+ (failure "Test true: ~s [~A]" v (if msg msg ""))))
+
+(defun assert-false (v &optional msg)
+ (when v
+ (failure "Test false ~A" (if msg msg ""))))
+