-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathst-boolean-tests.scm
89 lines (73 loc) · 1.71 KB
/
st-boolean-tests.scm
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;;; FILE: "st-boolean-tests.scm"
;;; IMPLEMENTS: Unit tests for st-boolean.scm
;;; AUTHOR: Ken Dickey
;;; DATE: 14 June 2016
;; (require 'st-boolean)
(define (setup-st-boolean) #f)
(define (cleanup-st-boolean) #f)
(add-test-suite 'st-boolean setup-st-boolean cleanup-st-boolean)
(add-eq-test 'st-boolean
st-false
(perform: st-nil 'notNil)
"nil notNil --> false")
(add-eq-test 'st-boolean
st-true
(perform: st-nil 'isNil)
"nil isNil --> true")
(add-eq-test 'st-boolean
3
(perform:with: st-nil 'ifNil: (lambda () 3))
"nil ifNil: [3]")
(add-eq-test 'st-boolean
3
(perform:with:with:
st-nil
'ifNil:ifNotNil:
(lambda () 3)
(lambda () 4))
"nil ifNil: [3] ifNotNil: [4]")
(add-eq-test 'st-boolean
4
(perform:with:with:
st-nil
'ifNotNil:ifNil:
(lambda () 3)
(lambda () 4))
"nil ifNotNil: [3] ifNil: [4]")
(add-eq-test 'st-boolean
3
(perform:with:with:
st-true
'ifTrue:ifFalse:
(lambda () 3)
(lambda () 4))
"true ifTrue: [3] ifFalse: [4]")
(add-eq-test 'st-boolean
4
(perform:with:with:
st-true
'ifFalse:ifTrue:
(lambda () 3)
(lambda () 4))
"true ifFalse: [3] ifTrue: [4]")
(add-eq-test 'st-boolean
4
(perform:with:with:
st-false
'ifTrue:ifFalse:
(lambda () 3)
(lambda () 4))
"false ifTrue: [3] ifFalse: [4]")
(add-eq-test 'st-boolean
3
(perform:with:with:
st-false
'ifFalse:ifTrue:
(lambda () 3)
(lambda () 4))
"false ifFalse: [3] ifTrue: [4]")
;; (ensure-exception-raised 'st-boolean
;; (make-error-string-predicate "Failed message send: #glerph to ")
;; (perform: %%test-object 'glerph)
;; "obj glerph -> doesNotUnderstand")
;;; --- E O F --- ;;;