-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
test.ss
30 lines (27 loc) · 1.01 KB
/
test.ss
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
(define (parse-test test)
(let ((expected (lookup 'expected test))
(input (lookup 'input test)))
(if (or (null? expected)
(number? (car expected)))
`(test-success ,(lookup 'description test)
(lambda (out expected)
(equal? (list-sort < out) (list-sort < expected)))
change
'(,(lookup 'target input)
,(lookup 'coins input))
',expected)
`(test-error ,(lookup 'description test)
change
'(,(lookup 'target input)
,(lookup 'coins input))))))
(define (spec->tests spec)
(map parse-test (lookup 'cases spec)))
(let ((spec (get-test-specification 'change)))
(put-problem!
'change
`((test . ,(spec->tests spec))
(version . ,(lookup 'version spec))
(skeleton . "change.scm")
(solution . "example.scm")
(stubs change)
(markdown . ,(splice-exercism 'change)))))