Skip to content

Commit

Permalink
Added missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asticode committed Nov 7, 2020
1 parent 3f1550b commit 35d9da8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions data_psi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func TestPSITableType(t *testing.T) {
assert.Equal(t, PSITableTypeST, psiTableType(114))
assert.Equal(t, PSITableTypeTDT, psiTableType(112))
assert.Equal(t, PSITableTypeTOT, psiTableType(115))
assert.Equal(t, PSITableTypeUnknown, psiTableType(1))
}

var psiSectionSyntaxHeader = &PSISectionSyntaxHeader{
Expand Down
16 changes: 15 additions & 1 deletion descriptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestParseDescriptor(t *testing.T) {
// Init
buf := &bytes.Buffer{}
w := astikit.NewBitsWriter(astikit.BitsWriterOptions{Writer: buf})
w.Write(uint16(242)) // Descriptors length
w.Write(uint16(255)) // Descriptors length
// AC3
w.Write(uint8(DescriptorTagAC3)) // Tag
w.Write(uint8(9)) // Length
Expand Down Expand Up @@ -214,6 +214,15 @@ func TestParseDescriptor(t *testing.T) {
w.Write(uint8(8)) // Length
w.Write(uint32(1)) // Format identifier
w.Write([]byte("test")) // Additional identification info
// Unknown
w.Write(uint8(0x1)) // Tag
w.Write(uint8(4)) // Length
w.Write([]byte("test")) // Content
// Extension unknown
w.Write(uint8(DescriptorTagExtension)) // Tag
w.Write(uint8(5)) // Length
w.Write(uint8(0)) // Extension tag
w.Write([]byte("test")) // Content

// Assert
ds, err := parseDescriptors(astikit.NewBytesIterator(buf.Bytes()))
Expand Down Expand Up @@ -371,4 +380,9 @@ func TestParseDescriptor(t *testing.T) {
AdditionalIdentificationInfo: []byte("test"),
FormatIdentifier: uint32(1),
})
assert.Equal(t, *ds[24].Unknown, DescriptorUnknown{
Content: []byte("test"),
Tag: 0x1,
})
assert.Equal(t, *ds[25].Extension.Unknown, []byte("test"))
}

0 comments on commit 35d9da8

Please sign in to comment.