streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

break_duration_test.go (650B)


      1 package scte35
      2 
      3 import (
      4 	"testing"
      5 )
      6 
      7 func TestPackBreakDuration(t *testing.T) {
      8 	dur := uint64(8589934492) // 2^33 - 100
      9 	bd := BreakDuration{true, dur}
     10 	want := [5]byte{
     11 		0b11111111,
     12 		0b11111111,
     13 		0b11111111,
     14 		0b11111111,
     15 		0b10011100,
     16 	}
     17 	got := packBreakDuration(&bd)
     18 	if want != got {
     19 		t.Errorf("packBreakDuration(%v) = %08b, want %08b", bd, got, want)
     20 	}
     21 }
     22 
     23 func TestReadBreakDuration(t *testing.T) {
     24 	want := samples[1].want.Command.Insert.Duration.Duration
     25 	a := [5]byte{0xfe, 0x00, 0x52, 0xcc, 0xf5}
     26 	got := readBreakDuration(a)
     27 	if want != got.Duration {
     28 		t.Errorf("readBreakDuration(%#x) = %d, want %d", a, got.Duration, want)
     29 	}
     30 }