simple-array.lsp 6.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Jan 26 07:20:31 2003
;;;; Contains: Tests of SIMPLE-ARRAY

(in-package :cl-test)

;;; Tests of simple-array by itself

(deftest simple-array.1.1
  (notnot-mv (typep #() 'simple-array))
  t)

(deftest simple-array.1.2
  (notnot-mv (typep #0aX 'simple-array))
  t)

(deftest simple-array.1.3
  (notnot-mv (typep #2a(()) 'simple-array))
  t)

(deftest simple-array.1.4
  (notnot-mv (typep #(1 2 3) 'simple-array))
  t)

(deftest simple-array.1.5
  (notnot-mv (typep "abcd" 'simple-array))
  t)

(deftest simple-array.1.6
  (notnot-mv (typep #*010101 'simple-array))
  t)

(deftest simple-array.1.7
  (typep nil 'simple-array)
  nil)

(deftest simple-array.1.8
  (typep 'x 'simple-array)
  nil)

(deftest simple-array.1.9
  (typep '(a b c) 'simple-array)
  nil)

(deftest simple-array.1.10
  (typep 10.0 'simple-array)
  nil)

(deftest simple-array.1.11
  (typep #'(lambda (x) (cons x nil)) 'simple-array)
  nil)

(deftest simple-array.1.12
  (typep 1 'simple-array)
  nil)

(deftest simple-array.1.13
  (typep (1+ most-positive-fixnum) 'simple-array)
  nil)

;;; Tests of (simple-array *)

(deftest simple-array.2.1
  (notnot-mv (typep #() '(simple-array *)))
  t)

(deftest simple-array.2.2
  (notnot-mv (typep #0aX '(simple-array *)))
  t)

(deftest simple-array.2.3
  (notnot-mv (typep #2a(()) '(simple-array *)))
  t)

(deftest simple-array.2.4
  (notnot-mv (typep #(1 2 3) '(simple-array *)))
  t)

(deftest simple-array.2.5
  (notnot-mv (typep "abcd" '(simple-array *)))
  t)

(deftest simple-array.2.6
  (notnot-mv (typep #*010101 '(simple-array *)))
  t)

;;; Tests of (simple-array * ())

(deftest simple-array.3.1
  (notnot-mv (typep #() '(simple-array * nil)))
  nil)

(deftest simple-array.3.2
 (notnot-mv (typep #0aX '(simple-array * nil)))
  t)

(deftest simple-array.3.3
  (typep #2a(()) '(simple-array * nil))
  nil)

(deftest simple-array.3.4
  (typep #(1 2 3) '(simple-array * nil))
  nil)

(deftest simple-array.3.5
  (typep "abcd" '(simple-array * nil))
  nil)

(deftest simple-array.3.6
  (typep #*010101 '(simple-array * nil))
  nil)

;;; Tests of (simple-array * 1)
;;; The '1' indicates rank, so this is equivalent to 'vector'

(deftest simple-array.4.1
  (notnot-mv (typep #() '(simple-array * 1)))
  t)

(deftest simple-array.4.2
  (typep #0aX '(simple-array * 1))
  nil)

(deftest simple-array.4.3
  (typep #2a(()) '(simple-array * 1))
  nil)

(deftest simple-array.4.4
  (notnot-mv (typep #(1 2 3) '(simple-array * 1)))
  t)

(deftest simple-array.4.5
  (notnot-mv (typep "abcd" '(simple-array * 1)))
  t)

(deftest simple-array.4.6
  (notnot-mv (typep #*010101 '(simple-array * 1)))
  t)

;;; Tests of (simple-array * 0)

(deftest simple-array.5.1
  (typep #() '(simple-array * 0))
  nil)

(deftest simple-array.5.2
  (notnot-mv (typep #0aX '(simple-array * 0)))
  t)

(deftest simple-array.5.3
  (typep #2a(()) '(simple-array * 0))
  nil)

(deftest simple-array.5.4
  (typep #(1 2 3) '(simple-array * 0))
  nil)

(deftest simple-array.5.5
  (typep "abcd" '(simple-array * 0))
  nil)

(deftest simple-array.5.6
  (typep #*010101 '(simple-array * 0))
  nil)

;;; Tests of (simple-array * *)

(deftest simple-array.6.1
  (notnot-mv (typep #() '(simple-array * *)))
  t)

(deftest simple-array.6.2
  (notnot-mv (typep #0aX '(simple-array * *)))
  t)

(deftest simple-array.6.3
  (notnot-mv (typep #2a(()) '(simple-array * *)))
  t)

(deftest simple-array.6.4
  (notnot-mv (typep #(1 2 3) '(simple-array * *)))
  t)

(deftest simple-array.6.5
  (notnot-mv (typep "abcd" '(simple-array * *)))
  t)

(deftest simple-array.6.6
  (notnot-mv (typep #*010101 '(simple-array * *)))
  t)

;;; Tests of (simple-array * 2)

(deftest simple-array.7.1
  (typep #() '(simple-array * 2))
  nil)

(deftest simple-array.7.2
  (typep #0aX '(simple-array * 2))
  nil)

(deftest simple-array.7.3
  (notnot-mv (typep #2a(()) '(simple-array * 2)))
  t)

(deftest simple-array.7.4
  (typep #(1 2 3) '(simple-array * 2))
  nil)

(deftest simple-array.7.5
  (typep "abcd" '(simple-array * 2))
  nil)

(deftest simple-array.7.6
  (typep #*010101 '(simple-array * 2))
  nil)

;;; Testing '(simple-array * (--))

(deftest simple-array.8.1
  (typep #() '(simple-array * (1)))
  nil)
sds's avatar
sds committed
224

225
226
227
228
229
230
231
232
233
234
235
(deftest simple-array.8.2
  (notnot-mv (typep #() '(simple-array * (0))))
  t)

(deftest simple-array.8.3
  (notnot-mv (typep #() '(simple-array * (*))))
  t)

(deftest simple-array.8.4
  (typep #(a b c) '(simple-array * (2)))
  nil)
sds's avatar
sds committed
236

237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
(deftest simple-array.8.5
  (notnot-mv (typep #(a b c) '(simple-array * (3))))
  t)

(deftest simple-array.8.6
  (notnot-mv (typep #(a b c) '(simple-array * (*))))
  t)

(deftest simple-array.8.7
  (typep #(a b c) '(simple-array * (4)))
  nil)

(deftest simple-array.8.8
  (typep #2a((a b c)) '(simple-array * (*)))
  nil)

(deftest simple-array.8.9
  (typep #2a((a b c)) '(simple-array * (3)))
  nil)

(deftest simple-array.8.10
  (typep #2a((a b c)) '(simple-array * (1)))
  nil)

(deftest simple-array.8.11
  (typep "abc" '(simple-array * (2)))
  nil)
sds's avatar
sds committed
264

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
(deftest simple-array.8.12
  (notnot-mv (typep "abc" '(simple-array * (3))))
  t)

(deftest simple-array.8.13
  (notnot-mv (typep "abc" '(simple-array * (*))))
  t)

(deftest simple-array.8.14
  (typep "abc" '(simple-array * (4)))
  nil)

;;; Two dimensional simple-array type tests

(deftest simple-array.9.1
  (typep #() '(simple-array * (* *)))
  nil)

(deftest simple-array.9.2
  (typep "abc" '(simple-array * (* *)))
  nil)

(deftest simple-array.9.3
  (typep #(a b c) '(simple-array * (3 *)))
  nil)

(deftest simple-array.9.4
  (typep #(a b c) '(simple-array * (* 3)))
  nil)

(deftest simple-array.9.5
  (typep "abc" '(simple-array * (3 *)))
  nil)

(deftest simple-array.9.6
  (typep "abc" '(simple-array * (* 3)))
  nil)

(deftest simple-array.9.7
  (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* *))))
  t)

(deftest simple-array.9.8
  (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 *))))
  t)

(deftest simple-array.9.9
  (typep #2a((a b)(c d)(e f)) '(simple-array * (2 *)))
  nil)

(deftest simple-array.9.10
  (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (* 2))))
  t)

(deftest simple-array.9.11
  (typep #2a((a b)(c d)(e f)) '(simple-array * (* 3)))
  nil)

(deftest simple-array.9.12
  (notnot-mv (typep #2a((a b)(c d)(e f)) '(simple-array * (3 2))))
  t)

(deftest simple-array.9.13
  (typep #2a((a b)(c d)(e f)) '(simple-array * (2 3)))
  nil)