-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathtests-1.3-req.scm
130 lines (118 loc) · 3.54 KB
/
tests-1.3-req.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
(add-tests-with-string-output-noboot "fxadd1"
[(fxadd1 0) => "1\n"]
[(fxadd1 -1) => "0\n"]
[(fxadd1 1) => "2\n"]
[(fxadd1 -100) => "-99\n"]
[(fxadd1 1000) => "1001\n"]
[(fxadd1 536870910) => "536870911\n"]
[(fxadd1 -536870912) => "-536870911\n"]
[(fxadd1 (fxadd1 0)) => "2\n"]
[(fxadd1 (fxadd1 (fxadd1 (fxadd1 (fxadd1 (fxadd1 12)))))) => "18\n"]
)
(add-tests-with-string-output-noboot "fxsub1"
[(fxsub1 0) => "-1\n"]
[(fxsub1 -1) => "-2\n"]
[(fxsub1 1) => "0\n"]
[(fxsub1 -100) => "-101\n"]
[(fxsub1 1000) => "999\n"]
[(fxsub1 536870911) => "536870910\n"]
[(fxsub1 -536870911) => "-536870912\n"]
[(fxsub1 (fxsub1 0)) => "-2\n"]
[(fxsub1 (fxsub1 (fxsub1 (fxsub1 (fxsub1 (fxsub1 12)))))) => "6\n"]
[(fxsub1 (fxadd1 0)) => "0\n"]
)
(add-tests-with-string-output "fixnum->char and char->fixnum"
[(fixnum->char 65) => "#\\A\n"]
[(fixnum->char 97) => "#\\a\n"]
[(fixnum->char 122) => "#\\z\n"]
[(fixnum->char 90) => "#\\Z\n"]
[(fixnum->char 48) => "#\\0\n"]
[(fixnum->char 57) => "#\\9\n"]
[(char->fixnum #\A) => "65\n"]
[(char->fixnum #\a) => "97\n"]
[(char->fixnum #\z) => "122\n"]
[(char->fixnum #\Z) => "90\n"]
[(char->fixnum #\0) => "48\n"]
[(char->fixnum #\9) => "57\n"]
[(char->fixnum (fixnum->char 12)) => "12\n"]
[(fixnum->char (char->fixnum #\x)) => "#\\x\n"]
)
(add-tests-with-string-output-noboot "fixnum?"
[(fixnum? 0) => "#t\n"]
[(fixnum? 1) => "#t\n"]
[(fixnum? -1) => "#t\n"]
[(fixnum? 37287) => "#t\n"]
[(fixnum? -23873) => "#t\n"]
[(fixnum? 536870911) => "#t\n"]
[(fixnum? -536870912) => "#t\n"]
[(fixnum? #t) => "#f\n"]
[(fixnum? #f) => "#f\n"]
[(fixnum? ()) => "#f\n"]
[(fixnum? #\Q) => "#f\n"]
[(fixnum? (fixnum? 12)) => "#f\n"]
[(fixnum? (fixnum? #f)) => "#f\n"]
[(fixnum? (fixnum? #\A)) => "#f\n"]
[(fixnum? (char->fixnum #\r)) => "#t\n"]
[(fixnum? (fixnum->char 12)) => "#f\n"]
)
(add-tests-with-string-output "fxzero?"
[(fxzero? 0) => "#t\n"]
[(fxzero? 1) => "#f\n"]
[(fxzero? -1) => "#f\n"]
[(fxzero? 64) => "#f\n"]
[(fxzero? 960) => "#f\n"]
)
(add-tests-with-string-output "null?"
[(null? ()) => "#t\n"]
[(null? #f) => "#f\n"]
[(null? #t) => "#f\n"]
[(null? (null? ())) => "#f\n"]
[(null? #\a) => "#f\n"]
[(null? 0) => "#f\n"]
[(null? -10) => "#f\n"]
[(null? 10) => "#f\n"]
)
(add-tests-with-string-output "boolean?"
[(boolean? #t) => "#t\n"]
[(boolean? #f) => "#t\n"]
[(boolean? 0) => "#f\n"]
[(boolean? 1) => "#f\n"]
[(boolean? -1) => "#f\n"]
[(boolean? ()) => "#f\n"]
[(boolean? #\a) => "#f\n"]
[(boolean? (boolean? 0)) => "#t\n"]
[(boolean? (fixnum? (boolean? 0))) => "#t\n"]
)
(add-tests-with-string-output "char?"
[(char? #\a) => "#t\n"]
[(char? #\Z) => "#t\n"]
[(char? #\newline) => "#t\n"]
[(char? #t) => "#f\n"]
[(char? #f) => "#f\n"]
[(char? ()) => "#f\n"]
[(char? (char? #t)) => "#f\n"]
[(char? 0) => "#f\n"]
[(char? 23870) => "#f\n"]
[(char? -23789) => "#f\n"]
)
(add-tests-with-string-output "not"
[(not #t) => "#f\n"]
[(not #f) => "#t\n"]
[(not 15) => "#f\n"]
[(not ()) => "#f\n"]
[(not #\A) => "#f\n"]
[(not (not #t)) => "#t\n"]
[(not (not #f)) => "#f\n"]
[(not (not 15)) => "#t\n"]
[(not (fixnum? 15)) => "#f\n"]
[(not (fixnum? #f)) => "#t\n"]
)
(add-tests-with-string-output-noboot "fxlognot"
[(fxlognot 0) => "-1\n"]
[(fxlognot -1) => "0\n"]
[(fxlognot 1) => "-2\n"]
[(fxlognot -2) => "1\n"]
[(fxlognot 536870911) => "-536870912\n"]
[(fxlognot -536870912) => "536870911\n"]
[(fxlognot (fxlognot 237463)) => "237463\n"]
)