improve coverage (#168)

This commit is contained in:
Alessandro Ros
2023-01-06 23:34:10 +01:00
committed by GitHub
parent a759ba9d01
commit 2e88705875
195 changed files with 535 additions and 63 deletions

View File

@@ -1,6 +1,7 @@
package h264
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
@@ -63,23 +64,32 @@ func TestAVCCUnmarshalError(t *testing.T) {
for _, ca := range []struct {
name string
enc []byte
err string
}{
{
"empty",
[]byte{},
"invalid length",
},
{
"invalid length",
[]byte{0x01},
"invalid length",
},
{
"invalid length",
[]byte{0x00, 0x00, 0x00, 0x03},
"invalid length",
},
{
"too many nalus",
bytes.Repeat([]byte{0x00, 0x00, 0x00, 0x01, 0x0a}, 21),
"NALU count (21) exceeds maximum allowed (20)",
},
} {
t.Run(ca.name, func(t *testing.T) {
_, err := AVCCUnmarshal(ca.enc)
require.Error(t, err)
require.EqualError(t, err, ca.err)
})
}
}