racket/collects/tests/r6rs/arithmetic/bitwise.ss
Matthew Flatt 53bc658226 r6rs tests and repairs
svn: r8905
2008-03-06 18:56:31 +00:00

26 lines
709 B
Scheme

#!r6rs
(library (tests r6rs arithmetic bitwise)
(export run-arithmetic-bitwise-tests)
(import (rnrs)
(tests r6rs test))
(define (run-arithmetic-bitwise-tests)
(test (bitwise-first-bit-set 0) -1)
(test (bitwise-first-bit-set 1) 0)
(test (bitwise-first-bit-set -4) 2)
(test (bitwise-arithmetic-shift -6 -1) -3)
(test (bitwise-arithmetic-shift -5 -1) -3)
(test (bitwise-arithmetic-shift -4 -1) -2)
(test (bitwise-arithmetic-shift -3 -1) -2)
(test (bitwise-arithmetic-shift -2 -1) -1)
(test (bitwise-arithmetic-shift -1 -1) -1)
(test (bitwise-reverse-bit-field #b1010010 1 4) 88) ; #b1011000
;;
))