This commit is contained in:
nareix 2015-12-07 11:37:07 +08:00
parent 848a9b2a39
commit c1b42164ff
2 changed files with 33 additions and 0 deletions

14
checksum_test.go Normal file
View 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
View 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()))
}