-
Notifications
You must be signed in to change notification settings - Fork 11
/
tests-1.5-req.scm
172 lines (159 loc) · 5.21 KB
/
tests-1.5-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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
(add-tests-with-string-output "fx+"
[(fx+ 1 2) => "3\n"]
[(fx+ 1 -2) => "-1\n"]
[(fx+ -1 2) => "1\n"]
[(fx+ -1 -2) => "-3\n"]
[(fx+ 536870911 -1) => "536870910\n"]
[(fx+ 536870910 1) => "536870911\n"]
[(fx+ -536870912 1) => "-536870911\n"]
[(fx+ -536870911 -1) => "-536870912\n"]
[(fx+ 536870911 -536870912) => "-1\n"]
[(fx+ 1 (fx+ 2 3)) => "6\n"]
[(fx+ 1 (fx+ 2 -3)) => "0\n"]
[(fx+ 1 (fx+ -2 3)) => "2\n"]
[(fx+ 1 (fx+ -2 -3)) => "-4\n"]
[(fx+ -1 (fx+ 2 3)) => "4\n"]
[(fx+ -1 (fx+ 2 -3)) => "-2\n"]
[(fx+ -1 (fx+ -2 3)) => "0\n"]
[(fx+ -1 (fx+ -2 -3)) => "-6\n"]
[(fx+ (fx+ 1 2) 3) => "6\n"]
[(fx+ (fx+ 1 2) -3) => "0\n"]
[(fx+ (fx+ 1 -2) 3) => "2\n"]
[(fx+ (fx+ 1 -2) -3) => "-4\n"]
[(fx+ (fx+ -1 2) 3) => "4\n"]
[(fx+ (fx+ -1 2) -3) => "-2\n"]
[(fx+ (fx+ -1 -2) 3) => "0\n"]
[(fx+ (fx+ -1 -2) -3) => "-6\n"]
[(fx+ (fx+ (fx+ (fx+ (fx+ (fx+ (fx+ (fx+ 1 2) 3) 4) 5) 6) 7) 8) 9) => "45\n"]
[(fx+ 1 (fx+ 2 (fx+ 3 (fx+ 4 (fx+ 5 (fx+ 6 (fx+ 7 (fx+ 8 9)))))))) => "45\n"]
)
(add-tests-with-string-output "fx-"
[(fx- 1 2) => "-1\n"]
[(fx- 1 -2) => "3\n"]
[(fx- -1 2) => "-3\n"]
[(fx- -1 -2) => "1\n"]
[(fx- 536870910 -1) => "536870911\n"]
[(fx- 536870911 1) => "536870910\n"]
[(fx- -536870911 1) => "-536870912\n"]
[(fx- -536870912 -1) => "-536870911\n"]
[(fx- 1 536870911) => "-536870910\n"]
[(fx- -1 536870911) => "-536870912\n"]
[(fx- 1 -536870910) => "536870911\n"]
[(fx- -1 -536870912) => "536870911\n"]
[(fx- 536870911 536870911) => "0\n"]
;[(fx- 536870911 -536870912) => "-1\n"]
[(fx- -536870911 -536870912) => "1\n"]
[(fx- 1 (fx- 2 3)) => "2\n"]
[(fx- 1 (fx- 2 -3)) => "-4\n"]
[(fx- 1 (fx- -2 3)) => "6\n"]
[(fx- 1 (fx- -2 -3)) => "0\n"]
[(fx- -1 (fx- 2 3)) => "0\n"]
[(fx- -1 (fx- 2 -3)) => "-6\n"]
[(fx- -1 (fx- -2 3)) => "4\n"]
[(fx- -1 (fx- -2 -3)) => "-2\n"]
[(fx- 0 (fx- -2 -3)) => "-1\n"]
[(fx- (fx- 1 2) 3) => "-4\n"]
[(fx- (fx- 1 2) -3) => "2\n"]
[(fx- (fx- 1 -2) 3) => "0\n"]
[(fx- (fx- 1 -2) -3) => "6\n"]
[(fx- (fx- -1 2) 3) => "-6\n"]
[(fx- (fx- -1 2) -3) => "0\n"]
[(fx- (fx- -1 -2) 3) => "-2\n"]
[(fx- (fx- -1 -2) -3) => "4\n"]
[(fx- (fx- (fx- (fx- (fx- (fx- (fx- (fx- 1 2) 3) 4) 5) 6) 7) 8) 9) => "-43\n"]
[(fx- 1 (fx- 2 (fx- 3 (fx- 4 (fx- 5 (fx- 6 (fx- 7 (fx- 8 9)))))))) => "5\n"]
)
(add-tests-with-string-output "fx*"
[(fx* 2 3) => "6\n"]
[(fx* 2 -3) => "-6\n"]
[(fx* -2 3) => "-6\n"]
[(fx* -2 -3) => "6\n"]
[(fx* 536870911 1) => "536870911\n"]
[(fx* 536870911 -1) => "-536870911\n"]
[(fx* -536870912 1) => "-536870912\n"]
[(fx* -536870911 -1) => "536870911\n"]
[(fx* 2 (fx* 3 4)) => "24\n"]
[(fx* (fx* 2 3) 4) => "24\n"]
[(fx* (fx* (fx* (fx* (fx* 2 3) 4) 5) 6) 7) => "5040\n"]
[(fx* 2 (fx* 3 (fx* 4 (fx* 5 (fx* 6 7))))) => "5040\n"]
)
(add-tests-with-string-output "fxlogand and fxlogor"
[(fxlogor 3 16) => "19\n"]
[(fxlogor 3 5) => "7\n"]
[(fxlogor 3 7) => "7\n"]
[(fxlognot (fxlogor (fxlognot 7) 1)) => "6\n"]
[(fxlognot (fxlogor 1 (fxlognot 7))) => "6\n"]
[(fxlogand 3 7) => "3\n"]
[(fxlogand 3 5) => "1\n"]
[(fxlogand 2346 (fxlognot 2346)) => "0\n"]
[(fxlogand (fxlognot 2346) 2346) => "0\n"]
[(fxlogand 2376 2376) => "2376\n"]
)
(add-tests-with-string-output "fx="
[(fx= 12 13) => "#f\n"]
[(fx= 12 12) => "#t\n"]
[(fx= 16 (fx+ 13 3)) => "#t\n"]
[(fx= 16 (fx+ 13 13)) => "#f\n"]
[(fx= (fx+ 13 3) 16) => "#t\n"]
[(fx= (fx+ 13 13) 16) => "#f\n"]
)
(add-tests-with-string-output "fx<"
[(fx< 12 13) => "#t\n"]
[(fx< 12 12) => "#f\n"]
[(fx< 13 12) => "#f\n"]
[(fx< 16 (fx+ 13 1)) => "#f\n"]
[(fx< 16 (fx+ 13 3)) => "#f\n"]
[(fx< 16 (fx+ 13 13)) => "#t\n"]
[(fx< (fx+ 13 1) 16) => "#t\n"]
[(fx< (fx+ 13 3) 16) => "#f\n"]
[(fx< (fx+ 13 13) 16) => "#f\n"]
)
(add-tests-with-string-output "fx<="
[(fx<= 12 13) => "#t\n"]
[(fx<= 12 12) => "#t\n"]
[(fx<= 13 12) => "#f\n"]
[(fx<= 16 (fx+ 13 1)) => "#f\n"]
[(fx<= 16 (fx+ 13 3)) => "#t\n"]
[(fx<= 16 (fx+ 13 13)) => "#t\n"]
[(fx<= (fx+ 13 1) 16) => "#t\n"]
[(fx<= (fx+ 13 3) 16) => "#t\n"]
[(fx<= (fx+ 13 13) 16) => "#f\n"]
)
(add-tests-with-string-output "fx>"
[(fx> 12 13) => "#f\n"]
[(fx> 12 12) => "#f\n"]
[(fx> 13 12) => "#t\n"]
[(fx> 16 (fx+ 13 1)) => "#t\n"]
[(fx> 16 (fx+ 13 3)) => "#f\n"]
[(fx> 16 (fx+ 13 13)) => "#f\n"]
[(fx> (fx+ 13 1) 16) => "#f\n"]
[(fx> (fx+ 13 3) 16) => "#f\n"]
[(fx> (fx+ 13 13) 16) => "#t\n"]
)
(add-tests-with-string-output "fx>="
[(fx>= 12 13) => "#f\n"]
[(fx>= 12 12) => "#t\n"]
[(fx>= 13 12) => "#t\n"]
[(fx>= 16 (fx+ 13 1)) => "#t\n"]
[(fx>= 16 (fx+ 13 3)) => "#t\n"]
[(fx>= 16 (fx+ 13 13)) => "#f\n"]
[(fx>= (fx+ 13 1) 16) => "#f\n"]
[(fx>= (fx+ 13 3) 16) => "#t\n"]
[(fx>= (fx+ 13 13) 16) => "#t\n"]
)
(add-tests-with-string-output "if"
[(if (fx= 12 13) 12 13) => "13\n"]
[(if (fx= 12 12) 13 14) => "13\n"]
[(if (fx< 12 13) 12 13) => "12\n"]
[(if (fx< 12 12) 13 14) => "14\n"]
[(if (fx< 13 12) 13 14) => "14\n"]
[(if (fx<= 12 13) 12 13) => "12\n"]
[(if (fx<= 12 12) 12 13) => "12\n"]
[(if (fx<= 13 12) 13 14) => "14\n"]
[(if (fx> 12 13) 12 13) => "13\n"]
[(if (fx> 12 12) 12 13) => "13\n"]
[(if (fx> 13 12) 13 14) => "13\n"]
[(if (fx>= 12 13) 12 13) => "13\n"]
[(if (fx>= 12 12) 12 13) => "12\n"]
[(if (fx>= 13 12) 13 14) => "13\n"]
)