Debian Codegraph @

scheme/tests/tests-3.2-req.scm

raw
1
2 (add-tests-with-string-output "error"
3 [(error 'foo "here") => ""])
4
5
6 (add-tests-with-string-output "apply error"
7 [(let ([f 6])
8 (f f)) => ""]
9 [(let ([f 6])
10 (f (f))) => ""]
11 [(1 2 3) => ""]
12 [(1 (3 4)) => ""]
13 [(let ([f (lambda () (1 2 3))])
14 12) => "12\n"]
15 )
16
17 (add-tests-with-string-output "arg-check for fixed-arg procedures"
18 [(let ([f (lambda () 12)])
19 (f)) => "12\n"]
20 [(let ([f (lambda () 12)])
21 (f 1)) => ""]
22 [(let ([f (lambda () 12)])
23 (f 1 2)) => ""]
24 [(let ([f (lambda (x) (fx+ x x))])
25 (f)) => ""]
26 [(let ([f (lambda (x) (fx+ x x))])
27 (f 1)) => "2\n"]
28 [(let ([f (lambda (x) (fx+ x x))])
29 (f 1 2)) => ""]
30 [(let ([f (lambda (x y) (fx* x (fx+ y y)))])
31 (f)) => ""]
32 [(let ([f (lambda (x y) (fx* x (fx+ y y)))])
33 (f 2)) => ""]
34 [(let ([f (lambda (x y) (fx* x (fx+ y y)))])
35 (f 2 3)) => "12\n"]
36 [(let ([f (lambda (x y) (fx* x (fx+ y y)))])
37 (f 2 3 4)) => ""]
38 )
39
40 (add-tests-with-string-output "arg-check for var-arg procedures"
41 [(let ([f (lambda x x)])
42 (f)) => "()\n"]
43 [(let ([f (lambda x x)])
44 (f 'a)) => "(a)\n"]
45 [(let ([f (lambda x x)])
46 (f 'a 'b)) => "(a b)\n"]
47 [(let ([f (lambda x x)])
48 (f 'a 'b 'c)) => "(a b c)\n"]
49 [(let ([f (lambda x x)])
50 (f 'a 'b 'c 'd)) => "(a b c d)\n"]
51
52 [(let ([f (lambda (x . rest) (vector x rest))])
53 (f)) => ""]
54 [(let ([f (lambda (x . rest) (vector x rest))])
55 (f 'a)) => "#(a ())\n"]
56 [(let ([f (lambda (x . rest) (vector x rest))])
57 (f 'a 'b)) => "#(a (b))\n"]
58 [(let ([f (lambda (x . rest) (vector x rest))])
59 (f 'a 'b 'c)) => "#(a (b c))\n"]
60 [(let ([f (lambda (x . rest) (vector x rest))])
61 (f 'a 'b 'c 'd)) => "#(a (b c d))\n"]
62
63 [(let ([f (lambda (x y . rest) (vector x y rest))])
64 (f)) => ""]
65 [(let ([f (lambda (x y . rest) (vector x y rest))])
66 (f 'a)) => ""]
67 [(let ([f (lambda (x y . rest) (vector x y rest))])
68 (f 'a 'b)) => "#(a b ())\n"]
69 [(let ([f (lambda (x y . rest) (vector x y rest))])
70 (f 'a 'b 'c)) => "#(a b (c))\n"]
71 [(let ([f (lambda (x y . rest) (vector x y rest))])
72 (f 'a 'b 'c 'd)) => "#(a b (c d))\n"]
73 )
74
75
76 ;;; (add-tests-with-string-output "arg-check for primitives"
77 ;;; [(cons 1 2 3) => ""]
78 ;;; [(cons 1) => ""]
79 ;;; [(vector-ref '#() 1 2 3 4) => ""]
80 ;;; [(vector-ref) => ""]
81 ;;; [(vector) => "#()\n"]
82 ;;; [(string) => "\"\"\n"]
83 ;;; )