source: trunk/source/tests/ansi-tests/array.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

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