working on tests for bit reader
This commit is contained in:
parent
de6bbef97f
commit
13e1f90ff7
@ -11,7 +11,7 @@ type BitReader struct {
|
||||
buffer [1]byte
|
||||
}
|
||||
|
||||
func New(reader io.Reader) *BitReader {
|
||||
func NewReader(reader io.Reader) *BitReader {
|
||||
return &BitReader{reader: reader}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,21 @@
|
||||
package streaming
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user