]> gitweb.factorcode.org Git - factor.git/blob - basis/bitstreams/bitstreams-tests.factor
initial bitstreams checkin
[factor.git] / basis / bitstreams / bitstreams-tests.factor
1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors bitstreams io io.streams.string kernel tools.test
4 grouping compression.lzw multiline ;
5 IN: bitstreams.tests
6
7 [ 1 ]
8 [ B{ 254 } <string-reader> <bitstream-reader> read-bit ] unit-test
9
10 [ 254 ]
11 [ B{ 254 } <string-reader> <bitstream-reader> 8 swap read-bits ] unit-test
12
13 [ 4095 ]
14 [ B{ 255 255 } <string-reader> <bitstream-reader> 12 swap read-bits ] unit-test
15
16 [ B{ 254 } ]
17 [
18     <string-writer> <bitstream-writer> 254 8 rot
19     [ write-bits ] keep stream>> >byte-array
20 ] unit-test
21
22
23 /*
24 [
25     
26 ] [
27     B{ 7 7 7 8 8 7 7 9 7 }
28     [ byte-array>bignum >bin 72 CHAR: 0 pad-head 9 group [ bin> ] map ]
29     [ lzw-compress ] bi
30 ] unit-test
31 */