X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fdefstruct.impure.lisp;h=3549268e1dbcc35bb5ba9b8953a999274e69ceea;hb=96bb2dc76dddb1a21b3886fa7522796879e9ed9d;hp=b80e723d663bcab5f87445ec274ad8eb14fc5684;hpb=6075b05401346ac20ec9a647fe192a2a959f3882;p=sbcl.git diff --git a/tests/defstruct.impure.lisp b/tests/defstruct.impure.lisp index b80e723..3549268 100644 --- a/tests/defstruct.impure.lisp +++ b/tests/defstruct.impure.lisp @@ -715,3 +715,25 @@ (make-raw-slot-equalp-bug :a 1d0 :b 3s0)))) (assert (not (equalp (make-raw-slot-equalp-bug :a 1d0 :b 2s0) (make-raw-slot-equalp-bug :a 2d0 :b 2s0))))) + +;;; Check that all slot types (non-raw and raw) can be initialized with +;;; constant arguments. +(defstruct constant-arg-inits + (a 42 :type t) + (b 1 :type fixnum) + (c 2 :type sb-vm:word) + (d 3.0 :type single-float) + (e 4.0d0 :type double-float) + (f #c(5.0 5.0) :type (complex single-float)) + (g #c(6.0d0 6.0d0) :type (complex double-float))) +(defun test-constant-arg-inits () + (let ((foo (make-constant-arg-inits))) + (declare (dynamic-extent foo)) + (assert (eql 42 (constant-arg-inits-a foo))) + (assert (eql 1 (constant-arg-inits-b foo))) + (assert (eql 2 (constant-arg-inits-c foo))) + (assert (eql 3.0 (constant-arg-inits-d foo))) + (assert (eql 4.0d0 (constant-arg-inits-e foo))) + (assert (eql #c(5.0 5.0) (constant-arg-inits-f foo))) + (assert (eql #c(6.0d0 6.0d0) (constant-arg-inits-g foo))))) +(make-constant-arg-inits)