38 lines
1.2 KiB
Scheme
38 lines
1.2 KiB
Scheme
(library (test-runner)
|
|
(export game-engine-test-runner)
|
|
(import (srfi srfi-64)
|
|
(scheme base)
|
|
(scheme write))
|
|
|
|
(define (%inc val)
|
|
(set! val (+ val 1)))
|
|
|
|
(define (game-engine-test-runner)
|
|
(let ((runner (test-runner-null))
|
|
(passed 0)
|
|
(failed 0)
|
|
(xpassed 0)
|
|
(xfailed 0)
|
|
(total 0))
|
|
(test-runner-on-test-end! runner
|
|
(lambda (runner)
|
|
(set! total (+ total 1))
|
|
(case (test-result-kind runner)
|
|
((pass) (set! passed (+ 1 passed)))
|
|
((xpass) (set! xpassed (+ 1 xpassed)))
|
|
((fail) (set! failed (+ 1 failed)))
|
|
((xfail) (set! xfailed (+ 1 xfailed)))
|
|
(else #t))))
|
|
(test-runner-on-final! runner
|
|
(lambda (runner)
|
|
(display
|
|
(string-append
|
|
"Total tests: " (number->string total)
|
|
"\nPassing tests: " (number->string passed)
|
|
"\nFailing tests: " (number->string failed)
|
|
"\nExpectedly failing tests: " (number->string xfailed)
|
|
"\nUnexpectedly passing tests: " (number->string xpassed)
|
|
"\n"))
|
|
(flush-output-port)))
|
|
runner)))
|