2
;;;; Author: Paul Dietz
3
;;;; Created: Thu Jan 23 06:32:02 2003
4
;;;; Contains: Tests of VECTOR (type and function)
8
;;; More tests of type vector in make-array.lsp
10
(deftest vector.type.1
11
(notnot-mv (typep #(a b c) 'vector))
14
(deftest vector.type.2
15
(notnot-mv (typep #() 'vector))
18
(deftest vector.type.3
19
(notnot-mv (typep "" 'vector))
22
(deftest vector.type.4
23
(notnot-mv (typep "abcdef" 'vector))
26
(deftest vector.type.5
27
(notnot-mv (typep #* 'vector))
30
(deftest vector.type.6
31
(notnot-mv (typep #*011011101011 'vector))
34
(deftest vector.type.7
35
(typep #0aNIL 'vector)
38
(deftest vector.type.8
39
(typep #2a((a b c d)) 'vector)
42
(deftest vector.type.9
43
(subtypep* 'vector 'array)
46
(deftest vector.type.10
47
(notnot-mv (typep #(a b c) '(vector *)))
50
(deftest vector.type.11
51
(notnot-mv (typep #(a b c) '(vector t)))
54
(deftest vector.type.12
55
(notnot-mv (typep "abcde" '(vector *)))
58
(deftest vector.type.13
59
(typep "abcdef" '(vector t))
62
(deftest vector.type.14
63
(notnot-mv (typep #*00110 '(vector *)))
66
(deftest vector.type.15
67
(typep #*00110 '(vector t))
70
(deftest vector.type.16
71
(notnot-mv (typep #(a b c) '(vector * 3)))
74
(deftest vector.type.17
75
(typep #(a b c) '(vector * 2))
78
(deftest vector.type.18
79
(typep #(a b c) '(vector * 4))
82
(deftest vector.type.19
83
(notnot-mv (typep #(a b c) '(vector t 3)))
86
(deftest vector.type.20
87
(typep #(a b c) '(vector t 2))
90
(deftest vector.type.21
91
(typep #(a b c) '(vector t 4))
94
(deftest vector.type.23
95
(notnot-mv (typep #(a b c) '(vector t *)))
98
(deftest vector.type.23a
99
(notnot-mv (typep "abcde" '(vector * 5)))
102
(deftest vector.type.24
103
(typep "abcde" '(vector * 4))
106
(deftest vector.type.25
107
(typep "abcde" '(vector * 6))
110
(deftest vector.type.26
111
(notnot-mv (typep "abcde" '(vector * *)))
114
(deftest vector.type.27
115
(typep "abcde" '(vector t 5))
118
(deftest vector.type.28
119
(typep "abcde" '(vector t 4))
122
(deftest vector.type.29
123
(typep "abcde" '(vector t 6))
126
(deftest vector.type.30
127
(typep "abcde" '(vector t *))
130
(deftest vector.type.31
131
(let ((s (coerce "abc" 'simple-base-string)))
132
(notnot-mv (typep s '(vector base-char))))
135
(deftest vector.type.32
136
(let ((s (coerce "abc" 'simple-base-string)))
137
(notnot-mv (typep s '(vector base-char 3))))
140
(deftest vector.type.33
141
(let ((s (coerce "abc" 'simple-base-string)))
142
(typep s '(vector base-char 2)))
145
(deftest vector.type.34
146
(let ((s (coerce "abc" 'simple-base-string)))
147
(typep s '(vector base-char 4)))
150
(deftest vector.type.35
151
(let ((s (coerce "abc" 'simple-base-string)))
152
(notnot-mv (typep s 'vector)))
155
(deftest vector.type.36
156
(let ((s (coerce "abc" 'simple-base-string)))
157
(notnot-mv (typep s '(vector *))))
160
(deftest vector.type.37
161
(let ((s (coerce "abc" 'simple-base-string)))
162
(notnot-mv (typep s '(vector * 3))))
165
(deftest vector.type.38
166
(let ((s (coerce "abc" 'simple-base-string)))
167
(notnot-mv (typep s '(vector * *))))
170
(deftest vector.type.39
171
(let ((s (coerce "abc" 'simple-base-string)))
172
(typep s '(vector t)))
175
(deftest vector.type.40
176
(let ((s (coerce "abc" 'simple-base-string)))
177
(typep s '(vector t *)))
180
(deftest vector.type.41
181
(notnot-mv (typep (make-array '10 :element-type 'short-float) 'vector))
184
(deftest vector.type.42
185
(notnot-mv (typep (make-array '10 :element-type 'single-float) 'vector))
188
(deftest vector.type.43
189
(notnot-mv (typep (make-array '10 :element-type 'double-float) 'vector))
192
(deftest vector.type.44
193
(notnot-mv (typep (make-array '10 :element-type 'long-float) 'vector))
197
;;; Tests of vector as class
199
(deftest vector-as-class.1
200
(notnot-mv (find-class 'vector))
203
(deftest vector-as-class.2
204
(notnot-mv (typep #() (find-class 'vector)))
207
(deftest vector-as-class.3
208
(notnot-mv (typep #(a b c) (find-class 'vector)))
211
(deftest vector-as-class.4
212
(notnot-mv (typep "" (find-class 'vector)))
215
(deftest vector-as-class.5
216
(notnot-mv (typep "abcd" (find-class 'vector)))
219
(deftest vector-as-class.6
220
(notnot-mv (typep #* (find-class 'vector)))
223
(deftest vector-as-class.7
224
(notnot-mv (typep #*01101010100 (find-class 'vector)))
227
(deftest vector-as-class.8
228
(typep #0aNIL (find-class 'vector))
231
(deftest vector-as-class.9
232
(typep #2a((a b)(c d)) (find-class 'vector))
235
(deftest vector-as-class.10
236
(typep (make-array '(1 0)) (find-class 'vector))
239
(deftest vector-as-class.11
240
(typep (make-array '(0 1)) (find-class 'vector))
243
(deftest vector-as-class.12
244
(typep 1 (find-class 'vector))
247
(deftest vector-as-class.13
248
(typep nil (find-class 'vector))
251
(deftest vector-as-class.14
252
(typep 'x (find-class 'vector))
255
(deftest vector-as-class.15
256
(typep '(a b c) (find-class 'vector))
259
(deftest vector-as-class.16
260
(typep 10.0 (find-class 'vector))
263
(deftest vector-as-class.17
264
(typep 3/5 (find-class 'vector))
267
(deftest vector-as-class.18
268
(typep (1+ most-positive-fixnum) (find-class 'vector))
271
;;;; Tests of the function VECTOR
282
(let* ((len (min 1000 (1- call-arguments-limit)))
283
(args (make-int-list len))
284
(v (apply #'vector args)))
286
(typep v '(vector t))
287
(typep v '(vector t *))
288
(typep v `(vector t ,len))
289
(typep v 'simple-vector)
290
(typep v `(simple-vector ,len))
299
(notnot-mv (typep (vector) '(vector t 0)))
303
(notnot-mv (typep (vector) 'simple-vector))
307
(notnot-mv (typep (vector) '(simple-vector 0)))
311
(notnot-mv (typep (vector 1 2 3) 'simple-vector))
315
(notnot-mv (typep (vector 1 2 3) '(simple-vector 3)))
319
(typep (vector #\a #\b #\c) 'string)
323
(notnot-mv (typep (vector 1 2 3) '(simple-vector *)))
326
(deftest vector.order.1
329
(vector (setf a (incf i)) (setf b (incf i)) (setf c (incf i)))