1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; While most of SBCL is derived from the CMU CL system, the test
5 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; This software is in the public domain and is provided with
9 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
10 ;;;; more information.
12 (with-test (:name
:length
)
14 (let ((simple-t (make-array 35))
15 (simple-u32 (make-array 50
16 :element-type
'(unsigned-byte 32)))
17 (simple-character (make-string 44))
18 (complex-t (make-array 4 :fill-pointer
3))
19 (complex-u32 (make-array 88
21 :element-type
'(unsigned-byte 32)))
22 (complex-character (make-array 14
23 :element-type
'character
25 (assert (= (length simple-t
) 35))
26 (assert (= (length simple-u32
) 50))
27 (assert (= (length simple-character
) 44))
28 (assert (= (length complex-t
) 3))
29 (assert (= (length complex-u32
) 88))
30 (assert (= (length complex-character
) 14))
31 (vector-push-extend #\a complex-t
)
32 (assert (= (length complex-t
) 4))
33 (assert-error (vector-push-extend #\b simple-t
))))))
35 (with-test (:name
:fill-pointer
)
36 (multiple-value-bind (fp1 index fp2 bool
)
37 (let ((a (make-array '(5) :fill-pointer
5 :adjustable
5
38 :initial-contents
'(a b c d e
))))
39 (values (fill-pointer a
)
40 (vector-push-extend 'x a
)
42 (<= (array-total-size a
) 5)))
48 (with-test (:name
:svref-unknown-type
)
49 (compile nil
`(lambda (a)
50 (declare ((vector undefined-type
) a
))
52 (compile nil
`(lambda (a)
53 (declare ((vector undefined-type
) a
))
54 (setf (svref a
0) 10))))
56 (with-test (:name
:svref-negative-index
)
59 (funcall (compile nil
`(lambda (vector index
)
60 (svref vector index
)))
62 (assert-error (test -
1))
63 (assert (= (test 0) 1))
64 (assert-error (test 1)))))
66 (with-test (:name
:fill-pointer-transform
)
68 (funcall (checked-compile `(lambda (x)
69 (setf (fill-pointer x
) 0)))
70 (make-array 2 :adjustable t
))
73 (with-test (:name
:concatenate-to-vector
)
74 (assert (sb-kernel:%concatenate-to-vector sb-vm
:simple-bit-vector-widetag