16 lines
394 B
Scheme
16 lines
394 B
Scheme
(define-syntax assert
|
|
(syntax-rules ()
|
|
((_ check body)
|
|
(let ((result body))
|
|
(when (not (check result))
|
|
(error "assertion error: " check body result))
|
|
result))))
|
|
|
|
(define-syntax asserts
|
|
(syntax-rules ()
|
|
((_ (check ...) body)
|
|
(let ((result body))
|
|
(when (not (check result)) (error "assertion error: " check body result)) ...
|
|
result))))
|
|
|