1 | ;-*- Mode: Lisp -*- |
---|
2 | ;;;; Author: Paul Dietz |
---|
3 | ;;;; Created: Sun Jan 26 07:20:31 2003 |
---|
4 | ;;;; Contains: Tests of SIMPLE-ARRAY |
---|
5 | |
---|
6 | (in-package :cl-test) |
---|
7 | |
---|
8 | ;;; Tests of simple-array by itself |
---|
9 | |
---|
10 | (deftest simple-array.1.1 |
---|
11 | (notnot-mv (typep #() 'simple-array)) |
---|
12 | t) |
---|
13 | |
---|
14 | (deftest simple-array.1.2 |
---|
15 | (notnot-mv (typep #0aX 'simple-array)) |
---|
16 | t) |
---|
17 | |
---|
18 | (deftest simple-array.1.3 |
---|
19 | (notnot-mv (typep #2a(()) 'simple-array)) |
---|
20 | t) |
---|
21 | |
---|
22 | (deftest simple-array.1.4 |
---|
23 | (notnot-mv (typep #(1 2 3) 'simple-array)) |
---|
24 | t) |
---|
25 | |
---|
26 | (deftest simple-array.1.5 |
---|
27 | (notnot-mv (typep "abcd" 'simple-array)) |
---|
28 | t) |
---|
29 | |
---|
30 | (deftest simple-array.1.6 |
---|
31 | (notnot-mv (typep #*010101 'simple-array)) |
---|
32 | t) |
---|
33 | |
---|
34 | (deftest simple-array.1.7 |
---|
35 | (typep nil 'simple-array) |
---|
36 | nil) |
---|
37 | |
---|
38 | (deftest simple-array.1.8 |
---|
39 | (typep 'x 'simple-array) |
---|
40 | nil) |
---|
41 | |
---|
42 | (deftest simple-array.1.9 |
---|
43 | (typep '(a b c) 'simple-array) |
---|
44 | nil) |
---|
45 | |
---|
46 | (deftest simple-array.1.10 |
---|
47 | (typep 10.0 'simple-array) |
---|
48 | nil) |
---|
49 | |
---|
50 | (deftest simple-array.1.11 |
---|
51 | (typep #'(lambda (x) (cons x nil)) 'simple-array) |
---|
52 | nil) |
---|
53 | |
---|
54 | (deftest simple-array.1.12 |
---|
55 | (typep 1 'simple-array) |
---|
56 | nil) |
---|
57 | |
---|
58 | (deftest simple-array.1.13 |
---|
59 | (typep (1+ most-positive-fixnum) 'simple-array) |
---|
60 | nil) |
---|
61 | |
---|
62 | ;;; Tests of (simple-array *) |
---|
63 | |
---|
64 | (deftest simple-array.2.1 |
---|
65 | (notnot-mv (typep #() '(simple-array *))) |
---|
66 | t) |
---|
67 | |
---|
68 | (deftest simple-array.2.2 |
---|
69 | (notnot-mv (typep #0aX '(simple-array *))) |
---|
70 | t) |
---|
71 | |
---|
72 | (deftest simple-array.2.3 |
---|
73 | (notnot-mv (typep #2a(()) '(simple-array *))) |
---|
74 | t) |
---|
75 | |
---|
76 | (deftest simple-array.2.4 |
---|
77 | (notnot-mv (typep #(1 2 3) '(simple-array *))) |
---|
78 | t) |
---|
79 | |
---|
80 | (deftest simple-array.2.5 |
---|
81 | (notnot-mv (typep "abcd" '(simple-array *))) |
---|
82 | t) |
---|
83 | |
---|
84 | (deftest simple-array.2.6 |
---|
85 | (notnot-mv (typep #*010101 '(simple-array *))) |
---|
86 | t) |
---|
87 | |
---|
88 | ;;; Tests of (simple-array * ()) |
---|
89 | |
---|
90 | (deftest simple-array.3.1 |
---|
91 | (notnot-mv (typep #() '(simple-array * nil))) |
---|
92 | nil) |
---|
93 | |
---|
94 | (deftest simple-array.3.2 |
---|
95 | (notnot-mv (typep #0aX '(simple-array * nil))) |
---|
96 | t) |
---|
97 | |
---|
98 | (deftest simple-array.3.3 |
---|
99 | (typep #2a(()) '(simple-array * nil)) |
---|
100 | nil) |
---|
101 | |
---|
102 | (deftest simple-array.3.4 |
---|
103 | (typep #(1 2 3) '(simple-array * nil)) |
---|
104 | nil) |
---|
105 | |
---|
106 | (deftest simple-array.3.5 |
---|
107 | (typep "abcd" '(simple-array * nil)) |
---|
108 | nil) |
---|
109 | |
---|
110 | (deftest simple-array.3.6 |
---|
111 | (typep #*010101 '(simple-array * nil)) |
---|
112 | nil) |
---|
113 | |
---|
114 | ;;; Tests of (simple-array * 1) |
---|
115 | ;;; The '1' indicates rank, so this is equivalent to 'vector' |
---|
116 | |
---|
117 | (deftest simple-array.4.1 |
---|
118 | (notnot-mv (typep #() '(simple-array * 1))) |
---|
119 | t) |
---|
120 | |
---|
121 | (deftest simple-array.4.2 |
---|
122 | (typep #0aX '(simple-array * 1)) |
---|
123 | nil) |
---|
124 | |
---|
125 | (deftest simple-array.4.3 |
---|
126 | (typep #2a(()) '(simple-array * 1)) |
---|
127 | nil) |
---|
128 | |
---|
129 | (deftest simple-array.4.4 |
---|
130 | (notnot-mv (typep #(1 2 3) '(simple-array * 1))) |
---|
131 | t) |
---|
132 | |
---|
133 | (deftest simple-array.4.5 |
---|
134 | (notnot-mv (typep "abcd" '(simple-array * 1))) |
---|
135 | t) |
---|
136 | |
---|
137 | (deftest simple-array.4.6 |
---|
138 | (notnot-mv (typep #*010101 '(simple-array * 1))) |
---|
139 | t) |
---|
140 | |
---|
141 | ;;; Tests of (simple-array * 0) |
---|
142 | |
---|
143 | (deftest simple-array.5.1 |
---|
144 | (typep #() '(simple-array * 0)) |
---|
145 | nil) |
---|
146 | |
---|
147 | (deftest simple-array.5.2 |
---|
148 | (notnot-mv (typep #0aX '(simple-array * 0))) |
---|
149 | t) |
---|
150 | |
---|
151 | (deftest simple-array.5.3 |
---|
152 | (typep #2a(()) '(simple-array * 0)) |
---|
153 | nil) |
---|
154 | |
---|
155 | (deftest simple-array.5.4 |
---|
156 | (typep #(1 2 3) '(simple-array * 0)) |
---|
157 | nil) |
---|
158 | |
---|
159 | (deftest simple-array.5.5 |
---|
160 | (typep "abcd" '(simple-array * 0)) |
---|
161 | nil) |
---|
162 | |
---|
163 | (deftest simple-array.5.6 |
---|
164 | (typep #*010101 '(simple-array * 0)) |
---|
165 | nil) |
---|
166 | |
---|
167 | ;;; Tests of (simple-array * *) |
---|
168 | |
---|
169 | (deftest simple-array.6.1 |
---|
170 | (notnot-mv (typep #() '(simple-array * *))) |
---|
171 | t) |
---|
172 | |
---|
173 | (deftest simple-array.6.2 |
---|
174 | (notnot-mv (typep #0aX '(simple-array * *))) |
---|
175 | t) |
---|
176 | |
---|
177 | (deftest simple-array.6.3 |
---|
178 | (notnot-mv (typep #2a(()) '(simple-array * *))) |
---|
179 | t) |
---|
180 | |
---|
181 | (deftest simple-array.6.4 |
---|
182 | (notnot-mv (typep #(1 2 3) '(simple-array * *))) |
---|
183 | t) |
---|
184 | |
---|
185 | (deftest simple-array.6.5 |
---|
186 | (notnot-mv (typep "abcd" '(simple-array * *))) |
---|
187 | t) |
---|
188 | |
---|
189 | (deftest simple-array.6.6 |
---|
190 | (notnot-mv (typep #*010101 '(simple-array * *))) |
---|
191 | t) |
---|
192 | |
---|
193 | ;;; Tests of (simple-array * 2) |
---|
194 | |
---|
195 | (deftest simple-array.7.1 |
---|
196 | (typep #() '(simple-array * 2)) |
---|
197 | nil) |
---|
198 | |
---|
199 | (deftest simple-array.7.2 |
---|
200 | (typep #0aX '(simple-array * 2)) |
---|
201 | nil) |
---|
202 | |
---|
203 | (deftest simple-array.7.3 |
---|
204 | (notnot-mv (typep #2a(()) '(simple-array * 2))) |
---|
205 | t) |
---|
206 | |
---|
207 | (deftest simple-array.7.4 |
---|
208 | (typep #(1 2 3) '(simple-array * 2)) |
---|
209 | nil) |
---|
210 | |
---|
211 | (deftest simple-array.7.5 |
---|
212 | (typep "abcd" '(simple-array * 2)) |
---|
213 | nil) |
---|
214 | |
---|
215 | (deftest simple-array.7.6 |
---|
216 | (typep #*010101 '(simple-array * 2)) |
---|
217 | nil) |
---|
218 | |
---|
219 | ;;; Testing '(simple-array * (--)) |
---|
220 | |
---|
221 | (deftest simple-array.8.1 |
---|
222 | (typep #() '(simple-array * (1))) |
---|
223 | nil) |
---|
224 | |
---|
225 | (deftest simple-array.8.2 |
---|
226 | (notnot-mv (typep #() '(simple-array * (0)))) |
---|
227 | t) |
---|
228 | |
---|
229 | (deftest simple-array.8.3 |
---|
230 | (notnot-mv (typep #() '(simple-array * (*)))) |
---|
231 | t) |
---|
232 | |
---|
233 | (deftest simple-array.8.4 |
---|
234 | (typep #(a b c) '(simple-array * (2))) |
---|
235 | nil) |
---|
236 | |
---|
237 | (deftest simple-array.8.5 |
---|
238 | (notnot-mv (typep #(a b c) '(simple-array * (3)))) |
---|
239 | t) |
---|
240 | |
---|
241 | (deftest simple-array.8.6 |
---|
242 | (notnot-mv (typep #(a b c) '(simple-array * (*)))) |
---|
243 | t) |
---|
244 | |
---|
245 | (deftest simple-array.8.7 |
---|
246 | (typep #(a b c) '(simple-array * (4))) |
---|
247 | nil) |
---|
248 | |
---|
249 | (deftest simple-array.8.8 |
---|
250 | (typep #2a((a b c)) '(simple-array * (*))) |
---|
251 | nil) |
---|
252 | |
---|
253 | (deftest simple-array.8.9 |
---|
254 | (typep #2a((a b c)) '(simple-array * (3))) |
---|
255 | nil) |
---|
256 | |
---|
257 | (deftest simple-array.8.10 |
---|
258 | (typep #2a((a b c)) '(simple-array * (1))) |
---|
259 | nil) |
---|
260 | |
---|
261 | (deftest simple-array.8.11 |
---|
262 | (typep "abc" '(simple-array * (2))) |
---|
263 | nil) |
---|
264 | |
---|
265 | (deftest simple-array.8.12 |
---|
266 | (notnot-mv (typep "abc" '(simple-array * (3)))) |
---|
267 | t) |
---|
268 | |
---|
269 | (deftest simple-array.8.13 |
---|
270 | (notnot-mv (typep "abc" '(simple-array * (*)))) |
---|
271 | t) |
---|
272 | |
---|
273 | (deftest simple-array.8.14 |
---|
274 | (typep "abc" '(simple-array * (4))) |
---|
275 | nil) |
---|
276 | |
---|
277 | ;;; Two dimensional simple-array type tests |
---|
278 | |
---|
279 | (deftest simple-array.9.1 |
---|
280 | (typep #() '(simple-array * (* *))) |
---|
281 | nil) |
---|
282 | |
---|
283 | (deftest simple-array.9.2 |
---|
284 | (typep "abc" '(simple-array * (* *))) |
---|
285 | nil) |
---|
286 | |
---|
287 | (deftest simple-array.9.3 |
---|
288 | (typep #(a b c) '(simple-array * (3 *))) |
---|
289 | nil) |
---|
290 | |
---|
291 | (deftest simple-array.9.4 |
---|
292 | (typep #(a b c) '(simple-array * (* 3))) |
---|
293 | nil) |
---|
294 | |
---|
295 | (deftest simple-array.9.5 |
---|
296 | (typep "abc" '(simple-array * (3 *))) |
---|
297 | nil) |
---|
298 | |
---|
299 | (deftest simple-array.9.6 |
---|
300 | (typep "abc" '(simple-array * (* 3))) |
---|
301 | nil) |
---|
302 | |
---|
303 | (deftest simple-array.9.7 |
---|
304 | (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* *)))) |
---|
305 | t) |
---|
306 | |
---|
307 | (deftest simple-array.9.8 |
---|
308 | (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 *)))) |
---|
309 | t) |
---|
310 | |
---|
311 | (deftest simple-array.9.9 |
---|
312 | (typep #2a((a b)(c d)(e f)) '(simple-array * (2 *))) |
---|
313 | nil) |
---|
314 | |
---|
315 | (deftest simple-array.9.10 |
---|
316 | (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* 2)))) |
---|
317 | t) |
---|
318 | |
---|
319 | (deftest simple-array.9.11 |
---|
320 | (typep #2a((a b)(c d)(e f)) '(simple-array * (* 3))) |
---|
321 | nil) |
---|
322 | |
---|
323 | (deftest simple-array.9.12 |
---|
324 | (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 2)))) |
---|
325 | t) |
---|
326 | |
---|
327 | (deftest simple-array.9.13 |
---|
328 | (typep #2a((a b)(c d)(e f)) '(simple-array * (2 3))) |
---|
329 | nil) |
---|