Guest User

Untitled

a guest
May 5th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.49 KB | None | 0 0
  1. (defun report-result (result form)
  2.   (format t "~:[FAIL~;pass~] ... ~a~%" result form)
  3.   result)
  4.  
  5. (defmacro combine-results (&body forms)
  6.   (with-gensyms (result)
  7.     `(let ((,result t))
  8.        ,@(loop for f in forms collect `(unless ,f (serf ,result nil)))
  9.        ,result)))
  10.  
  11. (defmacro check (&body forms)
  12.   `(combine-results
  13.      ,@(loop for f in forms collect `(report-result ,f ',f))))
  14.  
  15. (defun test-+ ()
  16.   (check
  17.     (= (+ 1 2) 3)
  18.     (= (+ 1 2 3) 6)
  19.     (= (+ -1 -3) -4)))
Add Comment
Please, Sign In to add comment