Fix make-array transforms.
[sbcl.git] / tests / vector.pure.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
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
6 ;;;; from CMU CL.
7 ;;;;
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.
11
12 (cl:in-package :cl-user)
13
14 (funcall (lambda ()
15            (let ((simple-t (make-array 35))
16                  (simple-u32 (make-array 50
17                                          :element-type '(unsigned-byte 32)))
18                  (simple-character (make-string 44))
19                  (complex-t (make-array 4 :fill-pointer 3))
20                  (complex-u32 (make-array 88
21                                           :adjustable t
22                                           :element-type '(unsigned-byte 32)))
23                  (complex-character (make-array 14
24                                                 :element-type 'character
25                                                 :fill-pointer t)))
26              (assert (= (length simple-t) 35))
27              (assert (= (length simple-u32) 50))
28              (assert (= (length simple-character) 44))
29              (assert (= (length complex-t) 3))
30              (assert (= (length complex-u32) 88))
31              (assert (= (length complex-character) 14))
32              (vector-push-extend #\a complex-t)
33              (assert (= (length complex-t) 4))
34              (assert (raises-error? (vector-push-extend #\b simple-t))))))
35
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)
41               (fill-pointer a)
42               (<= (array-total-size a) 5)))
43   (assert (= fp1 5))
44   (assert (= index 5))
45   (assert (= fp2 6))
46   (assert (not bool)))