17 lines
363 B
Go
17 lines
363 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestSerialize(t *testing.T) {
|
|
cmd := Command{
|
|
ID: CommandIDBeep,
|
|
Direction: DirectionFromHost,
|
|
Data: []byte{1},
|
|
}
|
|
if want, got := []byte{0x05, 0xe6, 0x04, 0x00, 0x01, 0xff, 0x10}, cmd.Serialize(); !bytes.Equal(want, got) {
|
|
t.Fatalf("Serialize failed: wanted %+v, got %+v", want, got)
|
|
}
|
|
}
|