lisp-game-jam/test/test-runner.scm

38 lines
1.2 KiB
Scheme
Raw Normal View History

2024-05-26 21:14:05 +00:00
(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)))