X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Farray.pure.lisp;h=fe9c4f083c418008eb787f32667a384dc4404b86;hb=2c4f8db463028034cf6d10c45f35e3b9ecb7378c;hp=a44193b5cc692b50deaf88277f6cd622d1fe1995;hpb=4898ef32c639b1c7f4ee13a5ba566ce6debd03e6;p=sbcl.git diff --git a/tests/array.pure.lisp b/tests/array.pure.lisp index a44193b..fe9c4f0 100644 --- a/tests/array.pure.lisp +++ b/tests/array.pure.lisp @@ -209,3 +209,37 @@ collect (logand 1 (funcall lf (aref v1 i) (aref v2 i)))) 'bit-vector) do (assert (bit-vector-equal r1 r2))))) + +;;; CLHS, ADJUST-ARRAY: An error of type error is signaled if +;;; fill-pointer is supplied and non-nil but array has no fill pointer. +(assert (eq :good + (handler-case + (let ((array (make-array 12))) + (assert (not (array-has-fill-pointer-p array))) + (adjust-array array 12 :fill-pointer t) + array) + (type-error () + :good)))) + +;;; SIMPLE-VECTOR-COMPARE-AND-SWAP + +(let ((v (vector 1))) + ;; basics + (assert (eql 1 (sb-kernel:simple-vector-compare-and-swap v 0 1 2))) + (assert (eql 2 (sb-kernel:simple-vector-compare-and-swap v 0 1 3))) + (assert (eql 2 (svref v 0))) + ;; bounds + (multiple-value-bind (res err) + (ignore-errors (sb-kernel:simple-vector-compare-and-swap v -1 1 2)) + (assert (not res)) + (assert (typep err 'type-error))) + (multiple-value-bind (res err) + (ignore-errors (sb-kernel:simple-vector-compare-and-swap v 1 1 2)) + (assert (not res)) + (assert (typep err 'type-error)))) + +;; type of the first argument +(multiple-value-bind (res err) + (ignore-errors (sb-kernel:simple-vector-compare-and-swap "foo" 1 1 2)) + (assert (not res)) + (assert (typep err 'type-error)))