1 USING: sequences sequences.private arrays bit-arrays kernel
2 tools.test math random ;
5 [ 100 ] [ 100 <bit-array> length ] unit-test
10 3 <bit-array> t 0 pick set-nth t 2 pick set-nth
17 { t f t } >bit-array >array
23 { t f t } >bit-array dup clone dup [ not ] change-each
30 { t f t t f } >bit-array dup clear-bits >array
36 { t f t t f } >bit-array dup set-bits >array
41 drop 100 [ 2 random zero? ] replicate
42 dup >bit-array >array =
47 1 2 { t f t f } <slice> >bit-array
50 [ ?{ f t } ] [ 0 2 ?{ f t f } subseq ] unit-test
52 [ ?{ t f t f f f } ] [ 6 ?{ t f t } resize ] unit-test
54 [ ?{ t t } ] [ 2 ?{ t t f t f t f t t t f t } resize ] unit-test
56 [ -10 ?{ } resize ] must-fail
58 [ -1 integer>bit-array ] must-fail
59 [ ?{ } ] [ 0 integer>bit-array ] unit-test
60 [ ?{ f t } ] [ 2 integer>bit-array ] unit-test
61 [ ?{ t t t t t t t t t } ] [ 511 integer>bit-array ] unit-test
63 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
64 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
65 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
66 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
68 HEX: ffffffffffffffffffffffffffffffff integer>bit-array
71 [ 14 ] [ ?{ f t t t } bit-array>integer ] unit-test
72 [ 0 ] [ ?{ } bit-array>integer ] unit-test
73 [ HEX: ffffffffffffffffffffffffffffffff ] [ ?{
74 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
75 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
76 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
77 t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t
78 } bit-array>integer ] unit-test