vector-push-extend.lsp 19.4 KB
Newer Older
pfdietz's avatar
pfdietz committed
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Jan 25 08:04:35 2003
;;;; Contains: Tests for VECTOR-PUSH-EXTEND

(in-package :cl-test)

(deftest vector-push-extend.1
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
10 11
                       :initial-contents '(a b c d e)))
        (i 0) x y)
pfdietz's avatar
pfdietz committed
12 13
    (values
     (fill-pointer a)
14
     (vector-push-extend (progn (setf x (incf i)) 'x)
sds's avatar
sds committed
15
                         (progn (setf y (incf i)) a))
pfdietz's avatar
pfdietz committed
16
     (fill-pointer a)
17 18 19
     a
     i x y))
  2 2 3 #(a b x) 2 1 2)
pfdietz's avatar
pfdietz committed
20 21 22

(deftest vector-push-extend.2
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
23 24
                       :adjustable t
                       :initial-contents '(a b c d e))))
pfdietz's avatar
pfdietz committed
25 26 27 28 29 30 31 32 33 34
    (values
     (fill-pointer a)
     (vector-push-extend 'x a)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(a b c d e x))

(deftest vector-push-extend.3
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
35 36
                       :initial-contents "abcde"
                       :element-type 'base-char)))
pfdietz's avatar
pfdietz committed
37 38 39 40 41 42 43 44 45
    (values
     (fill-pointer a)
     (vector-push-extend #\x a)
     (fill-pointer a)
     a))
  2 2 3 "abx")

(deftest vector-push-extend.4
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
46 47 48 49
                       :adjustable t
                       :initial-contents "abcde"
                       :element-type 'base-char))
        (i 0) x y z)
pfdietz's avatar
pfdietz committed
50 51
    (values
     (fill-pointer a)
52
     (vector-push-extend (progn (setf x (incf i)) #\x)
sds's avatar
sds committed
53 54
                         (progn (setf y (incf i)) a)
                         (progn (setf z (incf i)) 1))
pfdietz's avatar
pfdietz committed
55 56
     (fill-pointer a)
     (<= (array-total-size a) 5)
57 58 59
     a
     i x y z))
  5 5 6 nil "abcdex" 3 1 2 3)
pfdietz's avatar
pfdietz committed
60 61 62

(deftest vector-push-extend.5
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
63 64
                       :initial-contents "abcde"
                       :element-type 'character)))
pfdietz's avatar
pfdietz committed
65 66 67 68 69 70 71 72 73
    (values
     (fill-pointer a)
     (vector-push-extend #\x a)
     (fill-pointer a)
     a))
  2 2 3 "abx")

(deftest vector-push-extend.6
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
74 75 76
                       :adjustable t
                       :initial-contents "abcde"
                       :element-type 'character)))
pfdietz's avatar
pfdietz committed
77 78 79 80 81 82 83 84 85 86
    (values
     (fill-pointer a)
     (vector-push-extend #\x a 10)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil "abcdex")

(deftest vector-push-extend.7
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
87 88
                       :initial-contents '(0 1 1 0 0)
                       :element-type 'bit)))
pfdietz's avatar
pfdietz committed
89 90 91 92 93 94 95 96 97
    (values
     (fill-pointer a)
     (vector-push-extend 0 a)
     (fill-pointer a)
     a))
  2 2 3 #*010)

(deftest vector-push-extend.8
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
98 99 100
                       :adjustable t
                       :initial-contents '(0 0 0 0 0)
                       :element-type 'bit)))
pfdietz's avatar
pfdietz committed
101 102 103 104 105 106 107 108 109 110
    (values
     (fill-pointer a)
     (vector-push-extend 1 a 100)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #*000001)

(deftest vector-push-extend.9
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
111 112
                       :initial-contents '(1 2 3 4 5)
                       :element-type 'fixnum)))
pfdietz's avatar
pfdietz committed
113 114 115 116 117 118 119 120 121
    (values
     (fill-pointer a)
     (vector-push-extend 0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1 2 0))

(deftest vector-push-extend.10
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
122 123 124
                       :adjustable t
                       :initial-contents '(1 2 3 4 5)
                       :element-type 'fixnum)))
pfdietz's avatar
pfdietz committed
125 126 127 128 129 130 131 132 133 134
    (values
     (fill-pointer a)
     (vector-push-extend 0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1 2 3 4 5 0))

(deftest vector-push-extend.11
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
135 136
                       :initial-contents '(1 2 3 4 5)
                       :element-type '(integer 0 (256)))))
pfdietz's avatar
pfdietz committed
137 138 139 140 141 142 143 144 145
    (values
     (fill-pointer a)
     (vector-push-extend 0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1 2 0))

(deftest vector-push-extend.12
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
146 147 148
                       :adjustable t
                       :initial-contents '(1 2 3 4 5)
                       :element-type '(integer 0 (256)))))
pfdietz's avatar
pfdietz committed
149 150 151 152 153 154 155 156 157 158
    (values
     (fill-pointer a)
     (vector-push-extend 0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1 2 3 4 5 0))

(deftest vector-push-extend.13
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
159 160
                       :initial-contents '(1.0s0 2.0s0 3.0s0 4.0s0 5.0s0)
                       :element-type 'short-float)))
pfdietz's avatar
pfdietz committed
161 162 163 164 165 166 167 168 169
    (values
     (fill-pointer a)
     (vector-push-extend 0.0s0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1.0s0 2.0s0 0.0s0))

(deftest vector-push-extend.14
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
170 171 172
                       :adjustable t
                       :initial-contents '(1.0s0 2.0s0 3.0s0 4.0s0 5.0s0)
                       :element-type 'short-float)))
pfdietz's avatar
pfdietz committed
173 174 175 176 177 178 179 180 181 182
    (values
     (fill-pointer a)
     (vector-push-extend 0.0s0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1.0s0 2.0s0 3.0s0 4.0s0 5.0s0 0.0s0))

(deftest vector-push-extend.15
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
183 184
                       :initial-contents '(1.0f0 2.0f0 3.0f0 4.0f0 5.0f0)
                       :element-type 'single-float)))
pfdietz's avatar
pfdietz committed
185 186 187 188 189 190 191 192 193
    (values
     (fill-pointer a)
     (vector-push-extend 0.0f0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1.0f0 2.0f0 0.0f0))

(deftest vector-push-extend.16
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
194 195 196
                       :adjustable t
                       :initial-contents '(1.0f0 2.0f0 3.0f0 4.0f0 5.0f0)
                       :element-type 'single-float)))
pfdietz's avatar
pfdietz committed
197 198 199 200 201 202 203 204 205 206 207
    (values
     (fill-pointer a)
     (vector-push-extend 0.0f0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1.0f0 2.0f0 3.0f0 4.0f0 5.0f0 0.0f0))


(deftest vector-push-extend.17
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
208 209
                       :initial-contents '(1.0d0 2.0d0 3.0d0 4.0d0 5.0d0)
                       :element-type 'double-float)))
pfdietz's avatar
pfdietz committed
210 211 212 213 214 215 216 217 218
    (values
     (fill-pointer a)
     (vector-push-extend 0.0d0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1.0d0 2.0d0 0.0d0))

(deftest vector-push-extend.18
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
219 220 221
                       :adjustable t
                       :initial-contents '(1.0d0 2.0d0 3.0d0 4.0d0 5.0d0)
                       :element-type 'double-float)))
pfdietz's avatar
pfdietz committed
222 223 224 225 226 227 228 229 230 231
    (values
     (fill-pointer a)
     (vector-push-extend 0.0d0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1.0d0 2.0d0 3.0d0 4.0d0 5.0d0 0.0d0))

(deftest vector-push-extend.19
  (let ((a (make-array '(5) :fill-pointer 2
sds's avatar
sds committed
232 233
                       :initial-contents '(1.0l0 2.0l0 3.0l0 4.0l0 5.0l0)
                       :element-type 'long-float)))
pfdietz's avatar
pfdietz committed
234 235 236 237 238 239 240 241 242
    (values
     (fill-pointer a)
     (vector-push-extend 0.0l0 a)
     (fill-pointer a)
     a))
  2 2 3 #(1.0l0 2.0l0 0.0l0))

(deftest vector-push-extend.20
  (let ((a (make-array '(5) :fill-pointer 5
sds's avatar
sds committed
243 244 245
                       :adjustable t
                       :initial-contents '(1.0l0 2.0l0 3.0l0 4.0l0 5.0l0)
                       :element-type 'long-float)))
pfdietz's avatar
pfdietz committed
246 247 248 249 250 251 252 253 254
    (values
     (fill-pointer a)
     (vector-push-extend 0.0l0 a 1)
     (fill-pointer a)
     (<= (array-total-size a) 5)
     a))
  5 5 6 nil #(1.0l0 2.0l0 3.0l0 4.0l0 5.0l0 0.0l0))


255 256 257 258
;;; Tests on displaced arrays

(deftest vector-push-extend.21
  (let* ((a1 (make-array 10 :initial-element nil))
sds's avatar
sds committed
259 260 261
         (a2 (make-array 6 :displaced-to a1
                         :displaced-index-offset 2
                         :fill-pointer 0)))
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
    (values
     (fill-pointer a2)
     (map 'list #'identity a2)
     (vector-push-extend 'foo a2)
     (fill-pointer a2)
     (map 'list #'identity a2)
     (map 'list #'identity a1)))
  0
  ()
  0
  1
  (foo)
  (nil nil foo nil nil nil nil nil nil nil))

(deftest vector-push-extend.22
  (let* ((a1 (make-array 6 :initial-element nil))
sds's avatar
sds committed
278 279 280 281
         (a2 (make-array 0 :displaced-to a1
                         :displaced-index-offset 2
                         :adjustable t
                         :fill-pointer 0)))
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
    (values
     (fill-pointer a2)
     (map 'list #'identity a2)
     (vector-push-extend 'foo a2)
     (fill-pointer a2)
     (map 'list #'identity a2)
     (map 'list #'identity a1)
     (notnot (adjustable-array-p a2))
     (multiple-value-list (array-displacement a2))
     ))
  0
  ()
  0
  1
  (foo)
  (nil nil nil nil nil nil)
  t
  (nil 0))

(deftest vector-push-extend.23
  (let* ((a1 (make-array 10 :initial-element nil))
sds's avatar
sds committed
303 304 305 306
         (a2 (make-array 6 :displaced-to a1
                         :displaced-index-offset 2
                         :adjustable t
                         :fill-pointer 1)))
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
    (values
     (fill-pointer a2)
     (map 'list #'identity a2)
     (vector-push-extend 'foo a2)
     (fill-pointer a2)
     (map 'list #'identity a2)
     (map 'list #'identity a1)
     (notnot (adjustable-array-p a2))
     (eqt (array-displacement a2) a1)
     (nth-value 1 (array-displacement a2))
     ))
  1
  (nil)
  1
  2
  (nil foo)
  (nil nil nil foo nil nil nil nil nil nil)
  t
  t
  2)

(deftest vector-push-extend.24
  (let* ((a1 (make-array 4 :initial-element nil))
sds's avatar
sds committed
330 331 332 333
         (a2 (make-array 2 :displaced-to a1
                         :displaced-index-offset 2
                         :adjustable t
                         :fill-pointer 2)))
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
    (values
     (map 'list #'identity a1)
     (map 'list #'identity a2)
     (vector-push-extend 'foo a2 7)
     (fill-pointer a2)
     (map 'list #'identity a1)
     (map 'list #'identity a2)
     (array-dimension a2 0)
     (notnot (adjustable-array-p a2))
     (multiple-value-list (array-displacement a2))))
  (nil nil nil nil)
  (nil nil)
  2
  3
  (nil nil nil nil)
  (nil nil foo)
  9
  t
  (nil 0))

;;; Integer vectors

(deftest vector-push-extend.25
  (loop for adj in '(nil t)
sds's avatar
sds committed
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
        nconc
        (loop for bits from 1 to 64
              for etype = `(unsigned-byte ,bits)
              for a1 = (make-array 10 :initial-element 0
                                   :element-type etype)
              for a2 =(make-array 6
                                  :element-type etype
                                  :displaced-to a1
                                  :displaced-index-offset 2
                                  :adjustable adj
                                  :fill-pointer 0)
              for result = (list (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (vector-push-extend 1 a2)
                                 (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (map 'list #'identity a1))
              unless (equal result '(0 () 0 1 (1) (0 0 1 0 0 0 0 0 0 0)))
              collect (list etype adj result)))
377 378 379 380
  nil)

(deftest vector-push-extend.26
  (loop for bits from 1 to 64
sds's avatar
sds committed
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
        for etype = `(unsigned-byte ,bits)
        for a1 = (make-array 8 :initial-element 0
                             :element-type etype)
        for a2 = (make-array 6
                             :element-type etype
                             :displaced-to a1
                             :displaced-index-offset 2
                             :adjustable t
                             :fill-pointer 6)
        for result = (list (fill-pointer a2)
                           (map 'list #'identity a2)
                           (vector-push-extend 1 a2)
                           (fill-pointer a2)
                           (map 'list #'identity a2)
                           (map 'list #'identity a1)
                           (notnot (adjustable-array-p a2))
                           (multiple-value-list (array-displacement a1)))
        unless (equal result '(6 (0 0 0 0 0 0) 6 7 (0 0 0 0 0 0 1)
                                 (0 0 0 0 0 0 0 0) t (nil 0)))
        collect (list etype result))
401
  nil)
pfdietz's avatar
pfdietz committed
402

403 404 405 406
;;; strings

(deftest vector-push-extend.27
  (loop for adj in '(nil t)
sds's avatar
sds committed
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
        nconc
        (loop for etype in '(character base-char standard-char)
              for a1 = (make-array 10 :initial-element #\a
                                   :element-type etype)
              for a2 =(make-array 6
                                  :element-type etype
                                  :displaced-to a1
                                  :displaced-index-offset 2
                                  :adjustable adj
                                  :fill-pointer 0)
              for result = (list (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (vector-push-extend #\b a2)
                                 (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (map 'list #'identity a1))
              unless (equal result '(0 () 0 1 (#\b) (#\a #\a #\b #\a #\a #\a #\a #\a #\a #\a)))
              collect (list etype adj result)))
425 426 427 428
  nil)

(deftest vector-push-extend.28
  (loop for etype in '(character base-char standard-char)
sds's avatar
sds committed
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450
        for a1 = (make-array 8 :initial-element #\a
                             :element-type etype)
        for a2 = (make-array 6
                             :element-type etype
                             :displaced-to a1
                             :displaced-index-offset 2
                             :adjustable t
                             :fill-pointer 6)
        for result = (list (fill-pointer a2)
                           (map 'list #'identity a2)
                           (vector-push-extend #\b a2)
                           (fill-pointer a2)
                           (map 'list #'identity a2)
                           (map 'list #'identity a1)
                           (notnot (adjustable-array-p a2))
                           (multiple-value-list (array-displacement a1)))
        unless (equal result '(6 #.(coerce "aaaaaa" 'list)
                                 6 7
                                 #.(coerce "aaaaaab" 'list)
                                 #.(coerce "aaaaaaaa" 'list)
                                 t (nil 0)))
        collect (list etype result))
451 452 453 454 455 456
  nil)

;;; float tests

(deftest vector-push-extend.29
  (loop for adj in '(nil t)
sds's avatar
sds committed
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
        nconc
        (loop for etype in '(short-float single-float double-float long-float)
              for zero in '(0.0s0 0.0f0 0.0d0 0.0l0)
              for one in '(1.0s0 1.0f0 1.0d0 1.0l0)
              for a1 = (make-array 10 :initial-element zero
                                   :element-type etype)
              for a2 =(make-array 6
                                  :element-type etype
                                  :displaced-to a1
                                  :displaced-index-offset 2
                                  :adjustable adj
                                  :fill-pointer 0)
              for result = (list (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (vector-push-extend one a2)
                                 (fill-pointer a2)
                                 (map 'list #'identity a2)
                                 (map 'list #'identity a1))
              unless (equal result `(0 () 0 1 (,one) (,zero ,zero ,one ,zero ,zero ,zero ,zero ,zero ,zero ,zero)))
              collect (list etype adj result)))
477 478 479 480
  nil)

(deftest vector-push-extend.30
  (loop for etype in '(short-float single-float double-float long-float)
sds's avatar
sds committed
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
        for zero in '(0.0s0 0.0f0 0.0d0 0.0l0)
        for one in '(1.0s0 1.0f0 1.0d0 1.0l0)
        for a1 = (make-array 8 :initial-element zero
                             :element-type etype)
        for a2 = (make-array 6
                             :element-type etype
                             :displaced-to a1
                             :displaced-index-offset 2
                             :adjustable t
                             :fill-pointer 6)
        for result = (list (fill-pointer a2)
                           (map 'list #'identity a2)
                           (vector-push-extend one a2)
                           (fill-pointer a2)
                           (map 'list #'identity a2)
                           (map 'list #'identity a1)
                           (notnot (adjustable-array-p a2))
                           (multiple-value-list (array-displacement a1)))
        unless (equal result `(6 (,zero ,zero ,zero ,zero ,zero ,zero)
                                 6 7
                                 (,zero ,zero ,zero ,zero ,zero ,zero ,one)
                                 (,zero ,zero ,zero ,zero ,zero ,zero ,zero ,zero)
                                 t (nil 0)))
        collect (list etype result))
505 506 507
  nil)


pfdietz's avatar
pfdietz committed
508 509 510 511 512 513
;;; Error tests

(defun vector-push-extend-error-test (seq val)
  (declare (optimize (safety 3)))
  (handler-case
   (eval `(let ((a (copy-seq ,seq)))
sds's avatar
sds committed
514 515 516
            (declare (optimize (safety 3)))
            (or (notnot (array-has-fill-pointer-p a))
                (vector-push-extend ',val a 1))))
pfdietz's avatar
pfdietz committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
   (error () t)))

(deftest vector-push-extend.error.1
  (vector-push-extend-error-test #(a b c d) 'x)
  t)

(deftest vector-push-extend.error.2
  (vector-push-extend-error-test #*00000 1)
  t)

(deftest vector-push-extend.error.3
  (vector-push-extend-error-test "abcde" #\x)
  t)

(deftest vector-push-extend.error.4
  (vector-push-extend-error-test #() 'x)
  t)

(deftest vector-push-extend.error.5
  (vector-push-extend-error-test #* 1)
  t)

(deftest vector-push-extend.error.6
  (vector-push-extend-error-test "" #\x)
  t)

(deftest vector-push-extend.error.7
  (vector-push-extend-error-test (make-array '5 :element-type 'base-char
sds's avatar
sds committed
545 546
                                      :initial-element #\a)
                          #\x)
pfdietz's avatar
pfdietz committed
547 548 549 550
  t)

(deftest vector-push-extend.error.8
  (vector-push-extend-error-test (make-array '5 :element-type '(integer 0 (256))
sds's avatar
sds committed
551 552
                                      :initial-element 0)
                          17)
pfdietz's avatar
pfdietz committed
553 554 555 556
  t)

(deftest vector-push-extend.error.9
  (vector-push-extend-error-test (make-array '5 :element-type 'float
sds's avatar
sds committed
557 558
                                      :initial-element 1.0)
                          2.0)
pfdietz's avatar
pfdietz committed
559 560 561 562
  t)

(deftest vector-push-extend.error.10
  (vector-push-extend-error-test (make-array '5 :element-type 'short-float
sds's avatar
sds committed
563 564
                                      :initial-element 1.0s0)
                          2.0s0)
pfdietz's avatar
pfdietz committed
565 566 567 568
  t)

(deftest vector-push-extend.error.11
  (vector-push-extend-error-test (make-array '5 :element-type 'long-float
sds's avatar
sds committed
569 570
                                      :initial-element 1.0l0)
                          2.0l0)
pfdietz's avatar
pfdietz committed
571 572 573 574
  t)

(deftest vector-push-extend.error.12
  (vector-push-extend-error-test (make-array '5 :element-type 'single-float
sds's avatar
sds committed
575 576
                                      :initial-element 1.0f0)
                          2.0f0)
pfdietz's avatar
pfdietz committed
577 578 579 580
  t)

(deftest vector-push-extend.error.13
  (vector-push-extend-error-test (make-array '5 :element-type 'double-float
sds's avatar
sds committed
581 582
                                      :initial-element 1.0d0)
                          2.0d0)
pfdietz's avatar
pfdietz committed
583 584 585
  t)

(deftest vector-push-extend.error.14
586 587
  (signals-error (vector-push-extend) program-error)
  t)
pfdietz's avatar
pfdietz committed
588 589

(deftest vector-push-extend.error.15
590 591
  (signals-error (vector-push-extend (vector 1 2 3)) program-error)
  t)
pfdietz's avatar
pfdietz committed
592 593

(deftest vector-push-extend.error.16
594 595
  (signals-error (vector-push-extend (vector 1 2 3) 4 1 nil) program-error)
  t)
pfdietz's avatar
pfdietz committed
596 597

(deftest vector-push-extend.error.17
598 599 600 601 602
  (handler-case
   (eval
    `(locally
      (declare (optimize (safety 3)))
      (let ((a (make-array '5 :fill-pointer t :adjustable nil
sds's avatar
sds committed
603 604 605 606
                           :initial-element nil)))
        (or (notnot (adjustable-array-p a))  ; It's actually adjustable, or...
            (vector-push-extend a 'x)        ; ... this fails
            ))))
607
   (error () t))
pfdietz's avatar
pfdietz committed
608
  t)