avframes/main_test.go

36 lines
621 B
Go

package main
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMain(t *testing.T) {
testCases := []struct {
input []byte
expectedError string
}{
{
input: []byte{0, 0, 0, 0},
expectedError: "no header",
},
{
input: []byte{0, 0, 0, 1},
expectedError: "no header",
},
{
input: []byte{0xff, 0xfe, 0, 0}, // wrong
expectedError: "",
},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("Header %08b", tc.input), func(t *testing.T) {
_, err := newHeader(tc.input)
assert.EqualError(t, err, tc.expectedError)
})
}
}