package satel import ( "github.com/stretchr/testify/assert" "testing" ) func TestMakeNameEvent(t *testing.T) { assert := assert.New(t) name, err := makeNameEvent([]byte{01, 02, 03, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 0xFF}) assert.Equal(NameEvent{ DevType: DeviceType(1), DevNumber: 2, DevTypeFunction: 3, DevName: "0123456789ABCDEF", }, *name) assert.NoError(err) } func TestMakeNameEvent_tooShort(t *testing.T) { assert := assert.New(t) name, err := makeNameEvent([]byte{01, 02, 03, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}) assert.Nil(name) assert.Error(err) }