further samplerate tests
This commit is contained in:
parent
2171eba4c9
commit
bbd3dd881e
36
main_test.go
36
main_test.go
|
@ -6,6 +6,42 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHasSyncWord(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
bytes []byte
|
||||
expResult bool
|
||||
}{
|
||||
{
|
||||
"empty header",
|
||||
[]byte{0, 0, 0, 0},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"almost",
|
||||
[]byte{0xff, 0xc0, 0, 0},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"present",
|
||||
[]byte{0xff, 0xe0, 0, 0},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"full header",
|
||||
[]byte{0xff, 0xff, 0xff, 0xff},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
h := header(tc.bytes)
|
||||
assert.Equal(t, tc.expResult, h.HasSyncWord())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAudioVersionId(t *testing.T) {
|
||||
bytes := []byte{0xff, 0xe8, 0, 0}
|
||||
h := header(bytes)
|
||||
|
|
Loading…
Reference in New Issue