-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest-check.scm
32 lines (30 loc) · 1.03 KB
/
test-check.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(define-syntax eg
(syntax-rules ()
((_ tested-expression expected-result)
(begin
(printf "Testing ~a is ~a\n"
(quote tested-expression)
(quote expected-result))
(let* ((expected expected-result)
(produced tested-expression))
(or (equal? expected produced)
(errorf 'eg
"Failed: ~a~%Expected: ~a~%Computed: ~a~%"
'tested-expression expected produced)))))))
(define-syntax test-check
(syntax-rules ()
((_ title tested-expression expected-result)
(begin
(printf "Testing ~a\n" title)
(let* ((expected expected-result)
(produced tested-expression))
(or (equal? expected produced)
(errorf 'test-check
"Failed: ~a~%Expected: ~a~%Computed: ~a~%"
'tested-expression expected produced)))))))
(define-syntax test-disable
(syntax-rules ()
((_ title tested-expression expected-result)
(begin
(printf "Disable testing ~s\n" title)
#t))))