Improve some test cases for fixnum-width independence
authorAlastair Bridgewater <nyef_sbcl@lisphacker.com>
Mon, 28 Dec 2009 16:40:24 +0000 (11:40 -0500)
committerAlastair Bridgewater <nyef@virtdev-1.lisphacker.com>
Wed, 19 Oct 2011 19:49:32 +0000 (15:49 -0400)
  * 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.

contrib/sb-aclrepl/tests.lisp
tests/arith.pure.lisp

index 001b516..d308082 100644 (file)
@@ -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
 (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
 (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*
index d58da25..de2d600 100644 (file)
              ((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))))