add test
This commit is contained in:
parent
848a9b2a39
commit
c1b42164ff
14
checksum_test.go
Normal file
14
checksum_test.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
package ts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestChecksum(t *testing.T) {
|
||||||
|
b := []byte("hello world")
|
||||||
|
b = append(b, []byte{0xbb,0x08,0xec,0x87}...)
|
||||||
|
crc := updateIeeeCrc32(0xffffffff, b)
|
||||||
|
t.Logf("%x", crc)
|
||||||
|
}
|
||||||
|
|
19
writer_test.go
Normal file
19
writer_test.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
package ts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"encoding/hex"
|
||||||
|
"bytes"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestWriteTSHeader(t *testing.T) {
|
||||||
|
bw := &bytes.Buffer{}
|
||||||
|
w := &TSWriter{
|
||||||
|
W: bw,
|
||||||
|
PCR: 0x12345678,
|
||||||
|
}
|
||||||
|
w.Write([]byte{'h','e','l','o'}[:], false)
|
||||||
|
t.Logf("\n%s", hex.Dump(bw.Bytes()))
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user