@@ -154,21 +154,56 @@ int test_equal(void) {
154154int test_num (void ) {
155155 passed = 1 ;
156156
157+ check_equal ("(+)" , "0" );
158+ check_equal ("(+ 1)" , "1" );
159+ check_equal ("(+ 1 2)" , "3" );
160+ check_equal ("(+ 1 2 3)" , "6" );
161+ check_equal ("(1+ 1)" , "2" );
162+
163+ check_equal ("(- 1)" , "-1" );
164+ check_equal ("(- 1 2)" , "-1" );
165+ check_equal ("(- 1 2 3)" , "-4" );
166+ check_equal ("(1- 1)" , "0" );
167+
168+ check_equal ("(*)" , "1" );
169+ check_equal ("(* 1)" , "1" );
170+ check_equal ("(* 1 2)" , "2" );
171+ check_equal ("(* 1 2 3)" , "6" );
172+
173+ check_equal ("(/ 1 1)" , "1" );
174+ check_equal ("(/ 6 3)" , "2" );
175+ check_equal ("(/ 7 3)" , "2" );
176+ check_equal ("(/ 24 2 3)" , "4" );
177+
178+ check_true ("(= 1)" );
157179 check_true ("(= 1 1)" );
158180 check_false ("(= 1 2)" );
181+ check_true ("(= 1 1 1)" );
182+ check_false ("(= 1 2 1)" );
183+ check_false ("(= 1 1 2)" );
159184
185+ check_true ("(>= 1)" );
160186 check_true ("(>= 2 1)" );
161187 check_true ("(>= 1 1)" );
162188 check_false ("(>= 0 1)" );
189+ check_true ("(>= 2 1 1)" );
190+ check_false ("(>= 1 2 1)" );
191+ check_false ("(>= 1 1 2)" );
163192
193+ check_true ("(<= 1)" );
164194 check_false ("(<= 2 1)" );
165195 check_true ("(<= 1 1)" );
166196 check_true ("(<= 0 1)" );
197+ check_true ("(<= 1 1 2)" );
198+ check_false ("(<= 1 2 1)" );
199+ check_false ("(<= 2 1 1)" );
167200
201+ check_true ("(> 1)" );
168202 check_true ("(> 2 1)" );
169203 check_false ("(> 1 1)" );
170204 check_false ("(> 0 1)" );
171205
206+ check_true ("(< 1)" );
172207 check_false ("(< 2 1)" );
173208 check_false ("(< 1 1)" );
174209 check_true ("(< 0 1)" );
@@ -286,7 +321,7 @@ int test_callwv(void) {
286321 check_equal ("(call-with-values (lambda () (values)) (lambda xs xs))" , "()" );
287322 check_equal ("(call-with-values (lambda () (values 1)) (lambda xs xs))" , "(1)" );
288323 check_equal ("(call-with-values (lambda () (values 1 2 3)) (lambda xs xs))" , "(1 2 3)" );
289- check_equal ("(call-with-values (lambda () (values 1 2)) fx +)" , "3" );
324+ check_equal ("(call-with-values (lambda () (values 1 2)) +)" , "3" );
290325
291326 return passed ;
292327}
@@ -299,26 +334,26 @@ int test_callcc(void) {
299334 check_equal ("(let ([x #f]) (cons 1 (call/cc (lambda (k) (set! x k) 2))))" , "(1 . 2)" );
300335
301336 // from ChezScheme documentation
302- check_equal ("(call/cc (lambda (k) (fx * 5 (k 4))))" , "4" );
303- check_equal ("(fx + 2 (call/cc (lambda (k) (fx * 5 (k 4)))))" , "6" );
337+ check_equal ("(call/cc (lambda (k) (* 5 (k 4))))" , "4" );
338+ check_equal ("(+ 2 (call/cc (lambda (k) (* 5 (k 4)))))" , "6" );
304339 check_equal ("(letrec ([product "
305340 "(lambda (xs) "
306341 "(call/cc "
307342 "(lambda (break) "
308343 "(if (null? xs) "
309344 "1 "
310- "(if (fx = (car xs) 0) "
345+ "(if (= (car xs) 0) "
311346 "(break 0) "
312- "(fx * (car xs) (product (cdr xs))))))))]) "
347+ "(* (car xs) (product (cdr xs))))))))]) "
313348 "(product '(7 3 8 0 1 9 5)))" ,
314349 "0" );
315350 check_equal ("(let ([x (call/cc (lambda (k) k))]) "
316351 "(x (lambda (ignore) \"hi\")))" ,
317352 "\"hi\"" );
318353
319354 check_equal ("(letrec ([k* #f] "
320- "[y (fx1 + (call/cc (lambda (k) (set! k* k) 0)))]) "
321- "(if (fx < y 5) "
355+ "[y (1 + (call/cc (lambda (k) (set! k* k) 0)))]) "
356+ "(if (< y 5) "
322357 "(k* y) "
323358 "y))" ,
324359 "5" );
@@ -344,7 +379,7 @@ int test_dynamic_wind(void) {
344379 "(set! c c0) "
345380 "'talk1)))) "
346381 "(lambda () (add 'disconnect))) "
347- "(if (fx < (length path) 4) "
382+ "(if (< (length path) 4) "
348383 "(c 'talk2) "
349384 "(reverse path))))" ,
350385 "(connect talk1 disconnect connect talk2 disconnect)"
0 commit comments