Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun report-result (test test-name)
- (format t "~:[Fail~;Pass~] ... ~A~%" test test-name)
- test)
- (defmacro combine-results (&body forms)
- (with-gensyms (result)
- `(let ((,result t))
- ,@(loop for f in forms collect `(unless ,f (setf ,result nil)))
- ,result)))
- (defmacro check (&body forms)
- `(combine-results
- ,@(loop for f in forms collect `(report-result ,f ',f))))
- (defun test+- ()
- (check (= (+ 1 2 3) 6)
- (= (+ 2 3 4) 9)
- (= (- 2 1) 1)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement