]> gitweb.factorcode.org Git - factor.git/blob - basis/bitstreams/bitstreams-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor into clean-linux-x86-32
[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 byte-arrays io.encodings.binary
5 io.streams.byte-array ;
6 IN: bitstreams.tests
7
8 [ 1 t ]
9 [ B{ 254 } binary <byte-reader> <bitstream-reader> read-bit ] unit-test
10
11 [ 254 8 t ]
12 [ B{ 254 } binary <byte-reader> <bitstream-reader> 8 swap read-bits ] unit-test
13
14 [ 4095 12 t ]
15 [ B{ 255 255 } binary <byte-reader> <bitstream-reader> 12 swap read-bits ] unit-test
16
17 [ B{ 254 } ]
18 [
19     binary <byte-writer> <bitstream-writer> 254 8 rot
20     [ write-bits ] keep stream>> >byte-array
21 ] unit-test
22
23 [ 255 8 t ]
24 [ B{ 255 } binary <byte-reader> <bitstream-reader> 8 swap read-bits ] unit-test
25
26 [ 255 8 f ]
27 [ B{ 255 } binary <byte-reader> <bitstream-reader> 9 swap read-bits ] unit-test