working on tests for bit reader

This commit is contained in:
Alex Yatskov 2019-01-15 18:53:13 -08:00
parent de6bbef97f
commit 13e1f90ff7
2 changed files with 16 additions and 2 deletions

View File

@ -11,7 +11,7 @@ type BitReader struct {
buffer [1]byte buffer [1]byte
} }
func New(reader io.Reader) *BitReader { func NewReader(reader io.Reader) *BitReader {
return &BitReader{reader: reader} return &BitReader{reader: reader}
} }

View File

@ -1,7 +1,21 @@
package streaming package streaming
import "testing" import (
"bytes"
"fmt"
"testing"
)
func TestBitReader(t *testing.T) { func TestBitReader(t *testing.T) {
data := []byte{
0x69, // 01101001
0x96, // 10010110
0xf0, // 11110000
0xaa, // 10101010
0x00, // 00000000
0xff, // 11111111
}
reader := NewReader(bytes.NewReader(data))
fmt.Println(reader.ReadBits(2))
} }