From: Alastair Bridgewater Date: Mon, 28 Dec 2009 16:40:24 +0000 (-0500) Subject: Improve some test cases for fixnum-width independence X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=a53e74a650cf42012d8c66835e450acdf73c23d6;p=sbcl.git Improve some test cases for fixnum-width independence * In arith.pure.lisp, some test cases were defined in terms of n-lowtag-bits instead of n-fixnum-tag-bits. * In sb-aclrepl, the bignum used for testing fit within an (signed-byte 63), the largest possible fixnum type on a 64-bit system. * Thanks to Paul Khuong for finding and fixing the arith.pure.lisp tests. --- diff --git a/contrib/sb-aclrepl/tests.lisp b/contrib/sb-aclrepl/tests.lisp index 001b516..d308082 100644 --- a/contrib/sb-aclrepl/tests.lisp +++ b/contrib/sb-aclrepl/tests.lisp @@ -52,7 +52,7 @@ (defparameter *complex* #c(1 2)) (defparameter *ratio* 22/7) (defparameter *double* 5.5d0) -(defparameter *bignum* 1234567890123456789) +(defparameter *bignum* 4938271560493827156) (defparameter *array* (make-array '(3 3 2) :initial-element nil)) (defparameter *vector* (make-array '(20):initial-contents '(0 1 2 3 4 5 6 7 8 9 @@ -190,11 +190,11 @@ (case sb-vm::n-word-bits (32 (def-elements-tests *bignum* 2 - #(2112454933 287445236) + #(4154852436 1149780945) #((0 . :HEX32) (1 . :HEX32)))) (64 (def-elements-tests *bignum* 1 - #(1234567890123456789) + #(4938271560493827156) #((0 . :HEX64))))) (def-elements-tests *vector* 20 @@ -325,13 +325,13 @@ (case sb-vm::n-word-bits (32 (def-display-test *bignum* - "bignum 1234567890123456789 with 2 32-bit words - 0-> #x7DE98115 - 1-> #x112210F4")) + "bignum 4938271560493827156 with 2 32-bit words + 0-> #xF7A60454 + 1-> #x448843D1")) (64 (def-display-test *bignum* - "bignum 1234567890123456789 with 1 64-bit word - 0-> #x112210F47DE98115" + "bignum 4938271560493827156 with 1 64-bit word + 0-> #x448843D1F7A60454" ))) (def-display-test *vector* diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index d58da25..de2d600 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -151,11 +151,11 @@ ((1+ most-positive-fixnum) (1+ most-positive-fixnum) nil) ((1+ most-positive-fixnum) (1- most-negative-fixnum) t) (1 (ash most-negative-fixnum 1) nil) - (#.(- sb-vm:n-word-bits sb-vm:n-lowtag-bits) most-negative-fixnum t) - (#.(1+ (- sb-vm:n-word-bits sb-vm:n-lowtag-bits)) (ash most-negative-fixnum 1) t) - (#.(+ 2 (- sb-vm:n-word-bits sb-vm:n-lowtag-bits)) (ash most-negative-fixnum 1) t) - (#.(+ sb-vm:n-word-bits 32) (ash most-negative-fixnum #.(+ 32 sb-vm:n-lowtag-bits 1)) nil) - (#.(+ sb-vm:n-word-bits 33) (ash most-negative-fixnum #.(+ 32 sb-vm:n-lowtag-bits 1)) t))) + (#.(- sb-vm:n-word-bits sb-vm:n-fixnum-tag-bits 1) most-negative-fixnum t) + (#.(1+ (- sb-vm:n-word-bits sb-vm:n-fixnum-tag-bits 1)) (ash most-negative-fixnum 1) t) + (#.(+ 2 (- sb-vm:n-word-bits sb-vm:n-fixnum-tag-bits 1)) (ash most-negative-fixnum 1) t) + (#.(+ sb-vm:n-word-bits 32) (ash most-negative-fixnum #.(+ 32 sb-vm:n-fixnum-tag-bits 2)) nil) + (#.(+ sb-vm:n-word-bits 33) (ash most-negative-fixnum #.(+ 32 sb-vm:n-fixnum-tag-bits 2)) t))) (destructuring-bind (index int result) x (assert (eq (eval `(logbitp ,index ,int)) result))))