adjust test to not require distinguished 0.0 and -0.0; add some fixnum overflow tests
svn: r11011
This commit is contained in:
parent
fa857a40ac
commit
c13fa1d24c
|
@ -48,8 +48,6 @@
|
|||
|
||||
(define (run-arithmetic-fixnums-tests)
|
||||
|
||||
(test/exn (fx- (least-fixnum)) &implementation-restriction)
|
||||
|
||||
(test (fxfirst-bit-set 0) -1)
|
||||
(test (fxfirst-bit-set 1) 0)
|
||||
(test (fxfirst-bit-set -4) 2)
|
||||
|
@ -174,10 +172,15 @@
|
|||
(test (fx+ (greatest-fixnum) (least-fixnum)) -1)
|
||||
(test (fx+ 0 (greatest-fixnum)) (greatest-fixnum))
|
||||
(test (fx+ 0 (least-fixnum)) (least-fixnum))
|
||||
(test/exn (fx+ (greatest-fixnum) 1) &implementation-restriction)
|
||||
(test/exn (fx+ (least-fixnum) -1) &implementation-restriction)
|
||||
|
||||
(test (fx* 3 17) 51)
|
||||
(test (fx* 1 (least-fixnum)) (least-fixnum))
|
||||
(test (fx* 1 (greatest-fixnum)) (greatest-fixnum))
|
||||
(test (fx* -1 (greatest-fixnum)) (+ (least-fixnum) 1))
|
||||
(test/exn (fx* (greatest-fixnum) 2) &implementation-restriction)
|
||||
(test/exn (fx* (least-fixnum) -1) &implementation-restriction)
|
||||
|
||||
(test (fx- 1) -1)
|
||||
(test (fx- -1) 1)
|
||||
|
@ -188,6 +191,9 @@
|
|||
(test (fx- (greatest-fixnum) (greatest-fixnum)) 0)
|
||||
(test (fx- (least-fixnum) (least-fixnum)) 0)
|
||||
|
||||
(test/exn (fx- (least-fixnum)) &implementation-restriction)
|
||||
(test/exn (fx- (least-fixnum) 1) &implementation-restriction)
|
||||
|
||||
;; If you put N numbers here, it runs to O(N^3) tests!
|
||||
(carry-tests (list 0 1 2 -1 -2 38734 -3843 2484598 -348732487
|
||||
(greatest-fixnum) (least-fixnum)))
|
||||
|
@ -296,6 +302,7 @@
|
|||
(test (fxarithmetic-shift -1 -1) -1)
|
||||
(test (fxarithmetic-shift -10 2) -40)
|
||||
(test (fxarithmetic-shift -40 -2) -10)
|
||||
(test/exn (fxarithmetic-shift (greatest-fixnum) 1) &implementation-restriction)
|
||||
|
||||
(test (fxarithmetic-shift-left 1 1) 2)
|
||||
(test (fxarithmetic-shift-right 1 1) 0)
|
||||
|
@ -305,6 +312,7 @@
|
|||
(test (fxarithmetic-shift-right -1 1) -1)
|
||||
(test (fxarithmetic-shift-left -10 2) -40)
|
||||
(test (fxarithmetic-shift-right -40 2) -10)
|
||||
(test/exn (fxarithmetic-shift-left (greatest-fixnum) 1) &implementation-restriction)
|
||||
|
||||
(test (fxrotate-bit-field 10 0 2 0) 10)
|
||||
(test (fxrotate-bit-field 10 0 2 1) 9)
|
||||
|
|
|
@ -512,6 +512,7 @@
|
|||
(test (= +inf.0 +inf.0) #t)
|
||||
(test (= -inf.0 +inf.0) #f)
|
||||
(test (= -inf.0 -inf.0) #t)
|
||||
(test (= +nan.0 +nan.0) #f)
|
||||
|
||||
(try-reals
|
||||
(lambda (x)
|
||||
|
@ -831,7 +832,8 @@
|
|||
(test/approx (atan -inf.0) -1.5707963267948965)
|
||||
(test/approx (atan +inf.0) 1.5707963267948965)
|
||||
(test/approx (log -1.0+0.0i) 0.0+3.141592653589793i)
|
||||
(test/approx (log -1.0-0.0i) 0.0-3.141592653589793i)
|
||||
(unless (eqv? 0.0 -0.0)
|
||||
(test/approx (log -1.0-0.0i) 0.0-3.141592653589793i))
|
||||
|
||||
(test/approx (sqrt 5) 2.23606797749979)
|
||||
(test/approx (sqrt -5) 0.0+2.23606797749979i)
|
||||
|
@ -867,7 +869,8 @@
|
|||
|
||||
(test/approx (angle -1.0) 3.141592653589793)
|
||||
(test/approx (angle -1.0+0.0i) 3.141592653589793)
|
||||
(test/approx (angle -1.0-0.0i) -3.141592653589793)
|
||||
(unless (eqv? 0.0 -0.0)
|
||||
(test/approx (angle -1.0-0.0i) -3.141592653589793))
|
||||
(test (angle +inf.0) 0.0)
|
||||
(test/approx (angle -inf.0) 3.141592653589793)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user