2024-03-03 21:42:13 +00:00
|
|
|
package satel
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMakeNameEvent(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
2024-03-04 19:24:13 +00:00
|
|
|
name, err := makeNameEvent([]byte{01, 02, 03, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 0xFF})
|
2024-03-03 21:42:13 +00:00
|
|
|
assert.Equal(NameEvent{
|
|
|
|
DevType: DeviceType(1),
|
|
|
|
DevNumber: 2,
|
|
|
|
DevTypeFunction: 3,
|
|
|
|
DevName: "0123456789ABCDEF",
|
2024-03-04 19:24:13 +00:00
|
|
|
}, *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)
|
2024-03-03 21:42:13 +00:00
|
|
|
}
|