github.com/bluenviron/mediacommon@v1.9.3/pkg/codecs/h265/pps_test.go (about) 1 package h265 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 ) 8 9 func TestPPSUnmarshal(t *testing.T) { 10 for _, ca := range []struct { 11 name string 12 byts []byte 13 pps PPS 14 }{ 15 { 16 "default", 17 []byte{ 18 0x44, 0x01, 0xc1, 0x72, 0xb4, 0x62, 0x40, 19 }, 20 PPS{}, 21 }, 22 } { 23 t.Run(ca.name, func(t *testing.T) { 24 var pps PPS 25 err := pps.Unmarshal(ca.byts) 26 require.NoError(t, err) 27 require.Equal(t, ca.pps, pps) 28 }) 29 } 30 } 31 32 func FuzzPPSUnmarshal(f *testing.F) { 33 f.Fuzz(func(_ *testing.T, b []byte) { 34 var pps PPS 35 pps.Unmarshal(b) //nolint:errcheck 36 }) 37 }