-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscheme-test.ss
More file actions
executable file
·43 lines (35 loc) · 1.21 KB
/
scheme-test.ss
File metadata and controls
executable file
·43 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(load "strings.ss")
(string-repeat 5 "test")
(define (displayln text)
(begin (display text)
(newline)))
(define (show key value)
(begin (display key)
;(newline)
(display " => ")
(displayln value)))
(define test-run-count 0)
;;(displayln test-run-count)
(define test-succeeded-count 0)
(define test-failed-count 0)
(define (start-testing)
(set! test-run-count 0)
(set! test-succeeded-count 0)
(set! test-failed-count 0))
(define (finished-testing)
(displayln " ==========================================================")
(display " Number of tests: ")
(display test-run-count)
(display " Succeeded: ")
(display test-succeeded-count)
(display " Failed: ")
(displayln test-failed-count)
(displayln " =========================================================="))
(define (test assumption actual predicate? expected)
(set! test-run-count (+ test-run-count 1))
(cond ((predicate? expected actual) (displayln (& "Test \"" assumption "\" Succeeded!")))
(else (displayln (& "Test \"" assumption "\" Faild!"))
(display "\tExpected : ")
(displayln expected)
(display "\tbut was : ")
(displayln actual))))