From c13fa1d24c96b31c498084ede55ea17a88f93ca3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 31 Jul 2008 20:18:38 +0000 Subject: [PATCH] adjust test to not require distinguished 0.0 and -0.0; add some fixnum overflow tests svn: r11011 --- collects/tests/r6rs/arithmetic/fixnums.sls | 12 ++++++++++-- collects/tests/r6rs/base.sls | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/collects/tests/r6rs/arithmetic/fixnums.sls b/collects/tests/r6rs/arithmetic/fixnums.sls index b23914852a..48977a9052 100644 --- a/collects/tests/r6rs/arithmetic/fixnums.sls +++ b/collects/tests/r6rs/arithmetic/fixnums.sls @@ -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) diff --git a/collects/tests/r6rs/base.sls b/collects/tests/r6rs/base.sls index 8a4d5c0110..ae4a8b6b19 100644 --- a/collects/tests/r6rs/base.sls +++ b/collects/tests/r6rs/base.sls @@ -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)