Debian Codegraph @

src/old-tests/tests-1.3-req.scm

raw
1
2
3
4 (add-tests-with-string-output "fxadd1"
5 [(fxadd1 0) => "1\n"]
6 [(fxadd1 -1) => "0\n"]
7 [(fxadd1 1) => "2\n"]
8 [(fxadd1 -100) => "-99\n"]
9 [(fxadd1 1000) => "1001\n"]
10 [(fxadd1 536870910) => "536870911\n"]
11 [(fxadd1 -536870912) => "-536870911\n"]
12 [(fxadd1 (fxsub1 0)) => "0\n"]
13 [(fxsub1 (fxadd1 0)) => "0\n"]
14 [(fxadd1 (fxadd1 0)) => "2\n"]
15 [(fxadd1 (fxadd1 (fxadd1 (fxadd1 (fxadd1 (fxadd1 12)))))) => "18\n"]
16 )
17
18 (add-tests-with-string-output "integer->char and char->integer"
19 [(integer->char 65) => "#\\A\n"]
20 [(integer->char 97) => "#\\a\n"]
21 [(integer->char 122) => "#\\z\n"]
22 [(integer->char 90) => "#\\Z\n"]
23 [(integer->char 48) => "#\\0\n"]
24 [(integer->char 57) => "#\\9\n"]
25 [(char->integer #\A) => "65\n"]
26 [(char->integer #\a) => "97\n"]
27 [(char->integer #\z) => "122\n"]
28 [(char->integer #\Z) => "90\n"]
29 [(char->integer #\0) => "48\n"]
30 [(char->integer #\9) => "57\n"]
31 [(char->integer (integer->char 12)) => "12\n"]
32 [(integer->char (char->integer #\x)) => "#\\x\n"]
33 )
34
35 (add-tests-with-string-output "fixnum?"
36 [(fixnum? 0) => "#t\n"]
37 [(fixnum? 1) => "#t\n"]
38 [(fixnum? -1) => "#t\n"]
39 [(fixnum? 37287) => "#t\n"]
40 [(fixnum? -23873) => "#t\n"]
41 [(fixnum? 536870911) => "#t\n"]
42 [(fixnum? -536870912) => "#t\n"]
43 [(fixnum? #t) => "#f\n"]
44 [(fixnum? #f) => "#f\n"]
45 [(fixnum? ()) => "#f\n"]
46 [(fixnum? #\Q) => "#f\n"]
47 [(fixnum? (fixnum? 12)) => "#f\n"]
48 [(fixnum? (fixnum? #f)) => "#f\n"]
49 [(fixnum? (fixnum? #\A)) => "#f\n"]
50 [(fixnum? (char->integer #\r)) => "#t\n"]
51 [(fixnum? (integer->char 12)) => "#f\n"]
52 )
53
54
55 (add-tests-with-string-output "fxzero?"
56 [(fxzero? 0) => "#t\n"]
57 [(fxzero? 1) => "#f\n"]
58 [(fxzero? -1) => "#f\n"]
59 )
60
61 (add-tests-with-string-output "null?"
62 [(null? ()) => "#t\n"]
63 [(null? #f) => "#f\n"]
64 [(null? #t) => "#f\n"]
65 [(null? (null? ())) => "#f\n"]
66 [(null? #\a) => "#f\n"]
67 [(null? 0) => "#f\n"]
68 [(null? -10) => "#f\n"]
69 [(null? 10) => "#f\n"]
70 )
71
72 (add-tests-with-string-output "boolean?"
73 [(boolean? #t) => "#t\n"]
74 [(boolean? #f) => "#t\n"]
75 [(boolean? 0) => "#f\n"]
76 [(boolean? 1) => "#f\n"]
77 [(boolean? -1) => "#f\n"]
78 [(boolean? ()) => "#f\n"]
79 [(boolean? #\a) => "#f\n"]
80 [(boolean? (boolean? 0)) => "#t\n"]
81 [(boolean? (fixnum? (boolean? 0))) => "#t\n"]
82 )
83
84 (add-tests-with-string-output "char?"
85 [(char? #\a) => "#t\n"]
86 [(char? #\Z) => "#t\n"]
87 [(char? #\newline) => "#t\n"]
88 [(char? #t) => "#f\n"]
89 [(char? #f) => "#f\n"]
90 [(char? ()) => "#f\n"]
91 [(char? (char? #t)) => "#f\n"]
92 [(char? 0) => "#f\n"]
93 [(char? 23870) => "#f\n"]
94 [(char? -23789) => "#f\n"]
95 )
96
97 (add-tests-with-string-output "not"
98 [(not #t) => "#f\n"]
99 [(not #f) => "#t\n"]
100 [(not 15) => "#f\n"]
101 [(not ()) => "#f\n"]
102 [(not #\A) => "#f\n"]
103 [(not (not #t)) => "#t\n"]
104 [(not (not #f)) => "#f\n"]
105 [(not (not 15)) => "#t\n"]
106 [(not (fixnum? 15)) => "#f\n"]
107 [(not (fixnum? #f)) => "#t\n"]
108 )
109
110 (add-tests-with-string-output "fxlognot"
111 [(fxlognot 0) => "-1\n"]
112 [(fxlognot -1) => "0\n"]
113 [(fxlognot 1) => "-2\n"]
114 [(fxlognot -2) => "1\n"]
115 [(fxlognot 536870911) => "-536870912\n"]
116 [(fxlognot -536870912) => "536870911\n"]
117 [(fxlognot (fxlognot 237463)) => "237463\n"]
118 )
119