simplify format.Unmarshal; improve tests (#631)

This commit is contained in:
Alessandro Ros
2024-10-09 16:21:01 +02:00
committed by GitHub
parent 605f3e4972
commit 1ca217ae3a
117 changed files with 594 additions and 1242 deletions

View File

@@ -124,109 +124,3 @@ func TestMPEG4AudioDecEncoder(t *testing.T) {
require.Equal(t, [][]byte{{0x01, 0x02, 0x03, 0x04}}, byts)
})
}
func FuzzUnmarshalMPEG4AudioGeneric(f *testing.F) {
f.Fuzz(func(
_ *testing.T,
a bool,
b string,
c bool,
d string,
e bool,
f string,
g bool,
h string,
i bool,
j string,
k bool,
l string,
m bool,
n string,
) {
ma := map[string]string{}
if a {
ma["streamtype"] = b
}
if c {
ma["mode"] = d
}
if e {
ma["profile-level-id"] = f
}
if g {
ma["config"] = h
}
if i {
ma["sizelength"] = j
}
if k {
ma["indexlength"] = l
}
if m {
ma["indexdeltalength"] = n
}
fo, err := Unmarshal("audio", 96, "MPEG4-generic/48000/2", ma) //nolint:errcheck
if err == nil {
fo.(*MPEG4Audio).GetConfig()
}
})
}
func FuzzUnmarshalMPEG4AudioLATM(f *testing.F) {
f.Fuzz(func(
_ *testing.T,
a bool,
b string,
c bool,
d string,
e bool,
f string,
g bool,
h string,
i bool,
j string,
k bool,
l string,
) {
ma := map[string]string{}
if a {
ma["profile-level-id"] = b
}
if c {
ma["bitrate"] = d
}
if e {
ma["cpresent"] = f
}
if g {
ma["config"] = h
}
if i {
ma["object"] = j
}
if k {
ma["sbr-enabled"] = l
}
fo, err := Unmarshal("audio", 96, "MP4A-LATM/48000/2", ma)
if err == nil {
fo.(*MPEG4Audio).RTPMap()
fo.(*MPEG4Audio).FMTP()
fo.(*MPEG4Audio).GetConfig()
}
})
}