-
Notifications
You must be signed in to change notification settings - Fork 84
/
sei136_test.go
53 lines (48 loc) · 987 Bytes
/
sei136_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package sei
import (
"testing"
"github.com/go-test/deep"
)
func TestSei136Clock(t *testing.T) {
cl := CreateClockTS()
cl.TimeOffsetValue = 1300
cl.NFrames = 5
cl.Hours = 12
cl.Minutes = 30
cl.Seconds = 10
cl.ClockTimeStampFlag = true
cl.UnitsFieldBasedFlag = true
cl.FullTimeStampFlag = false
cl.SecondsFlag = true
cl.MinutesFlag = true
cl.HoursFlag = true
cl.DiscontinuityFlag = false
cl.CntDroppedFlag = false
cl.CountingType = 1
cl.TimeOffsetLength = 11
tc := TimeCodeSEI{}
tc.Clocks = append(tc.Clocks, cl)
tc.Clocks = append(tc.Clocks, cl)
pl := tc.Payload()
str := tc.String()
if str == "" {
t.Error("String() failed")
}
if len(pl) == 0 {
t.Error("Payload() failed")
}
seiData := SEIData{
payloadType: SEITimeCodeType,
payload: pl,
}
sei, err := DecodeTimeCodeSEI(&seiData)
if err != nil {
t.Error(err)
}
tcDec := sei.(*TimeCodeSEI)
decCl := tcDec.Clocks[0]
diff := deep.Equal(cl, decCl)
if diff != nil {
t.Error(diff)
}
}