1 USING: alien sequences sequences.private arrays bit-arrays kernel
2 tools.test math random ;
5 [ -1 <bit-array> ] [ T{ bad-array-length f -1 } = ] must-fail-with
7 [ 100 ] [ 100 <bit-array> length ] unit-test
12 3 <bit-array> t 0 pick set-nth t 2 pick set-nth
19 { t f t } >bit-array >array
25 { t f t } >bit-array dup clone [ not ] map!
32 { t f t t f } >bit-array dup clear-bits >array
38 { t f t t f } >bit-array dup set-bits >array
43 drop 100 [ 2 random zero? ] replicate
44 dup >bit-array >array =
49 1 2 { t f t f } <slice> >bit-array
52 [ ?{ f t } ] [ 0 2 ?{ f t f } subseq ] unit-test
54 [ ?{ t f t f f f } ] [ 6 ?{ t f t } resize ] unit-test
56 [ ?{ t t } ] [ 2 ?{ t t f t f t f t t t f t } resize ] unit-test
58 [ -10 ?{ } resize ] must-fail
60 [ -1 integer>bit-array ] must-fail
61 [ ?{ } ] [ 0 integer>bit-array ] unit-test
62 [ ?{ f t } ] [ 2 integer>bit-array ] unit-test
63 [ ?{ t t t t t t t t t } ] [ 511 integer>bit-array ] unit-test
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
67 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 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
70 0xffffffffffffffffffffffffffffffff integer>bit-array
73 [ 14 ] [ ?{ f t t t } bit-array>integer ] unit-test
74 [ 0 ] [ ?{ } bit-array>integer ] unit-test
75 [ 0xffffffffffffffffffffffffffffffff ] [ ?{
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 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
79 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
80 } bit-array>integer ] unit-test
82 [ 49 ] [ 49 <bit-array> dup set-bits [ ] count ] unit-test
84 [ 1 ] [ ?{ f t f t } byte-length ] unit-test
86 [ 0xa ] [ ?{ f t f t } bit-array>integer ] unit-test
88 [ 0x100 ] [ ?{ f f f f f f f f t } bit-array>integer ] unit-test