print test statistics at the end of all tests

This commit is contained in:
Yuichi Nishiwaki 2014-06-28 20:58:53 +09:00
parent 7da5786ef3
commit b2a14ca0f1
1 changed files with 20 additions and 3 deletions

View File

@ -44,11 +44,27 @@
;; support, the full numeric tower and all standard libraries ;; support, the full numeric tower and all standard libraries
;; provided. ;; provided.
(define (test-begin . o) #f) (define test-counter 0)
(define counter 0)
(define failure-counter 0)
(define (test-end . o) #f) (define (print-statistics)
(newline)
(display "Test Result: ")
(write (- counter failure-counter))
(display " / ")
(write counter)
(display " [PASS/TOTAL]")
(display "")
(newline))
(define counter 1) (define (test-begin . o)
(set! test-counter (+ test-counter 1)))
(define (test-end . o)
(set! test-counter (- test-counter 1))
(if (= test-counter 0)
(print-statistics)))
(define-syntax test (define-syntax test
(syntax-rules () (syntax-rules ()
@ -66,6 +82,7 @@
(newline) (newline)
) )
((not (equal? res expected)) ((not (equal? res expected))
(set! failure-counter (+ failure-counter 1))
(display " FAIL: ") (display " FAIL: ")
(write 'expr) (write 'expr)
(newline) (newline)