;;;;
;;;; Author: Craig Brozefsky <craig@onshore.com>
;;;; Put in public domain by onShore, Inc
;;;;
;;;; Author: Craig Brozefsky <craig@onshore.com>
;;;; Put in public domain by onShore, Inc
;;; First we define some basic fixtures that we are going to need to
;;; perform our tests. A fixture is a place to hold data we need
;;; First we define some basic fixtures that we are going to need to
;;; perform our tests. A fixture is a place to hold data we need
(defmethod subtraction-test ((test math-fixture))
(let ((result (- (numberb test) (numbera test))))
(unless (= result 1)
(failure "Result was not 1 when subtracting ~A ~A"
(defmethod subtraction-test ((test math-fixture))
(let ((result (- (numberb test) (numbera test))))
(unless (= result 1)
(failure "Result was not 1 when subtracting ~A ~A"
;;; This method is meant to signal a failure
(defmethod subtraction-test2 ((test math-fixture))
(let ((result (- (numbera test) (numberb test))))
(unless (= result 1)
(failure "Result was not 1 when subtracting ~A ~A"
;;; This method is meant to signal a failure
(defmethod subtraction-test2 ((test math-fixture))
(let ((result (- (numbera test) (numberb test))))
(unless (= result 1)
(failure "Result was not 1 when subtracting ~A ~A"
- "Math Test Suite"
- "Simple test suite for arithmetic operators."
- ("Addition Test" 'math-fixture
- :test-thunk 'addition-test
- :description "A simple test of the + operator")
- ("Subtraction Test" 'math-fixture
- :test-thunk 'subtraction-test
- :description "A simple test of the - operator")))
+ "Math Test Suite"
+ "Simple test suite for arithmetic operators."
+ ("Addition Test" 'math-fixture
+ :test-thunk 'addition-test
+ :description "A simple test of the + operator")
+ ("Subtraction Test" 'math-fixture
+ :test-thunk 'subtraction-test
+ :description "A simple test of the - operator")))
- :test-thunk 'subtraction-test2
- :description "A broken substraction test, should fail.")
- math-test-suite)
+ :test-thunk 'subtraction-test2
+ :description "A broken substraction test, should fail.")
+ math-test-suite)
;;;; Finally we can run our test suite and see how it performs.
;;;; (report-result (run-test math-test-suite) :verbose t)
;;;; Finally we can run our test suite and see how it performs.
;;;; (report-result (run-test math-test-suite) :verbose t)