Compare expected value and the result only once.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
parent
24b4cafe65
commit
1455c7d4a5
|
@ -39,30 +39,29 @@
|
||||||
(let ((res expr))
|
(let ((res expr))
|
||||||
(display "case ")
|
(display "case ")
|
||||||
(write counter)
|
(write counter)
|
||||||
(cond
|
(if (equal? res expected)
|
||||||
((equal? res expected)
|
(begin
|
||||||
(display "[0;32m PASS: ")
|
(display "[0;32m PASS: ")
|
||||||
(write 'expr)
|
(write 'expr)
|
||||||
(display " equals ")
|
(display " equals ")
|
||||||
(write expected)
|
(write expected)
|
||||||
(display "[0;39m")
|
(display "[0;39m")
|
||||||
(newline)
|
(newline))
|
||||||
)
|
(begin
|
||||||
((not (equal? res expected))
|
(set! failure-counter (+ failure-counter 1))
|
||||||
(set! failure-counter (+ failure-counter 1))
|
(let ((out (open-output-string)))
|
||||||
(let ((out (open-output-string)))
|
(display " [0;31mFAIL: " out)
|
||||||
(display " [0;31mFAIL: " out)
|
(write 'expr out)
|
||||||
(write 'expr out)
|
(newline out)
|
||||||
(newline out)
|
(display " expected " out)
|
||||||
(display " expected " out)
|
(write expected out)
|
||||||
(write expected out)
|
(display " but got " out)
|
||||||
(display " but got " out)
|
(write res out)
|
||||||
(write res out)
|
(display "[0;39m" out)
|
||||||
(display "[0;39m" out)
|
(newline out)
|
||||||
(newline out)
|
(let ((str (get-output-string out)))
|
||||||
(let ((str (get-output-string out)))
|
(set! fails (cons str fails))
|
||||||
(set! fails (cons str fails))
|
(display str)))))
|
||||||
(display str)))))
|
|
||||||
(set! counter (+ counter 1))))))
|
(set! counter (+ counter 1))))))
|
||||||
|
|
||||||
(define-syntax test-values
|
(define-syntax test-values
|
||||||
|
|
Loading…
Reference in New Issue