commit
643d86c709
|
@ -36,33 +36,34 @@
|
|||
(define-syntax test
|
||||
(syntax-rules ()
|
||||
((test expected expr)
|
||||
(test expected expr equal?))
|
||||
((test expected expr =)
|
||||
(let ((res expr))
|
||||
(display "case ")
|
||||
(write counter)
|
||||
(cond
|
||||
((equal? res expected)
|
||||
(display "[0;32m PASS: ")
|
||||
(write 'expr)
|
||||
(display " equals ")
|
||||
(write expected)
|
||||
(display "[0;39m")
|
||||
(newline)
|
||||
)
|
||||
((not (equal? res expected))
|
||||
(set! failure-counter (+ failure-counter 1))
|
||||
(let ((out (open-output-string)))
|
||||
(display " [0;31mFAIL: " out)
|
||||
(write 'expr out)
|
||||
(newline out)
|
||||
(display " expected " out)
|
||||
(write expected out)
|
||||
(display " but got " out)
|
||||
(write res out)
|
||||
(display "[0;39m" out)
|
||||
(newline out)
|
||||
(let ((str (get-output-string out)))
|
||||
(set! fails (cons str fails))
|
||||
(display str)))))
|
||||
(if (= res expected)
|
||||
(begin
|
||||
(display "[0;32m PASS: ")
|
||||
(write 'expr)
|
||||
(display " equals ")
|
||||
(write expected)
|
||||
(display "[0;39m")
|
||||
(newline))
|
||||
(begin
|
||||
(set! failure-counter (+ failure-counter 1))
|
||||
(let ((out (open-output-string)))
|
||||
(display " [0;31mFAIL: " out)
|
||||
(write 'expr out)
|
||||
(newline out)
|
||||
(display " expected " out)
|
||||
(write expected out)
|
||||
(display " but got " out)
|
||||
(write res out)
|
||||
(display "[0;39m" out)
|
||||
(newline out)
|
||||
(let ((str (get-output-string out)))
|
||||
(set! fails (cons str fails))
|
||||
(display str)))))
|
||||
(set! counter (+ counter 1))))))
|
||||
|
||||
(define-syntax test-values
|
||||
|
|
Loading…
Reference in New Issue