factor/basis/math/bits/bits-tests.factor

34 lines
990 B
Factor
Raw Normal View History

2009-02-20 21:14:54 -05:00
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
2009-02-22 20:41:47 -05:00
USING: tools.test math math.bits sequences arrays ;
2009-02-20 21:14:54 -05:00
IN: math.bits.tests
{ t } [ 0b111111 3 <bits> second ] unit-test
{ { t t t } } [ 0b111111 3 <bits> >array ] unit-test
{ f } [ 0b111101 3 <bits> second ] unit-test
{ { f f t } } [ 0b111100 3 <bits> >array ] unit-test
{ 3 } [ 0b111111 3 <bits> length ] unit-test
{ 6 } [ 0b111111 make-bits length ] unit-test
{ 0 } [ 0 make-bits length ] unit-test
{ 2 } [ 3 make-bits length ] unit-test
{ 1 } [ 1 make-bits length ] unit-test
[ -3 make-bits length ] [ non-negative-integer-expected? ] must-fail-with
2009-02-22 20:41:47 -05:00
! Odd bug
{ t } [
2009-02-22 20:41:47 -05:00
1067811677921310779 make-bits
1067811677921310779 >bignum make-bits
sequence=
] unit-test
{ t } [
1067811677921310779 make-bits last
2009-02-22 20:41:47 -05:00
] unit-test
{ t } [
1067811677921310779 >bignum make-bits last
] unit-test
2009-06-01 23:39:02 -04:00
{ 6 } [ 6 make-bits bits>number ] unit-test
{ 6 } [ 6 3 <bits> >array bits>number ] unit-test