diff options
author | Kevin Ryde <user42@zip.com.au> | 2005-03-13 00:21:45 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2005-03-13 00:21:45 +0000 |
commit | afd09cfba06bfa0ef174852ace6dd7f8de23bd60 (patch) | |
tree | 94be83d65661b6e9276dfbbab773b13a0a6d65d7 | |
parent | f1531813b8bfbad5302aa9053e97b4c3cbb918dc (diff) | |
download | guile-afd09cfba06bfa0ef174852ace6dd7f8de23bd60.tar.gz |
(logior): New tests, exercising negative bignums reducing to inum.
-rw-r--r-- | test-suite/tests/numbers.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test index 6934a34ce..c4bb04432 100644 --- a/test-suite/tests/numbers.test +++ b/test-suite/tests/numbers.test @@ -2809,6 +2809,35 @@ (= i (logcount n)))))) ;;; +;;; logior +;;; + +(with-test-prefix "logior" + (pass-if (eqv? -1 (logior (ash -1 1) 1))) + + ;; check that bignum or bignum+inum args will reduce to an inum + (let () + (define (test x y) + (pass-if (list x y '=> -1) + (eqv? -1 (logior x y))) + (pass-if (list y x '=> -1) + (eqv? -1 (logior y x)))) + (test (ash -1 8) #xFF) + (test (ash -1 28) #x0FFFFFFF) + (test (ash -1 29) #x1FFFFFFF) + (test (ash -1 30) #x3FFFFFFF) + (test (ash -1 31) #x7FFFFFFF) + (test (ash -1 32) #xFFFFFFFF) + (test (ash -1 33) #x1FFFFFFFF) + (test (ash -1 60) #x0FFFFFFFFFFFFFFF) + (test (ash -1 61) #x1FFFFFFFFFFFFFFF) + (test (ash -1 62) #x3FFFFFFFFFFFFFFF) + (test (ash -1 63) #x7FFFFFFFFFFFFFFF) + (test (ash -1 64) #xFFFFFFFFFFFFFFFF) + (test (ash -1 65) #x1FFFFFFFFFFFFFFFF) + (test (ash -1 128) #xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))) + +;;; ;;; lognot ;;; |