add txframe bytes test
This commit is contained in:
parent
1f379e7e6a
commit
86c9d8d492
|
@ -19,6 +19,28 @@ func TestTxFrame_Bytes(t *testing.T) {
|
||||||
want []byte
|
want []byte
|
||||||
}{
|
}{
|
||||||
// TODO: Add test cases.
|
// TODO: Add test cases.
|
||||||
|
{
|
||||||
|
name: "64 bit unicast",
|
||||||
|
fields: fields{
|
||||||
|
Id: 0x52,
|
||||||
|
Destination: 0x0013A20012345678,
|
||||||
|
BCastRadius: 0,
|
||||||
|
Options: 0,
|
||||||
|
Payload: []byte{0x54, 0x78, 0x44, 0x61, 0x74, 0x61},
|
||||||
|
},
|
||||||
|
want: []byte{0x10, 0x52, 0x00, 0x13, 0xA2, 0x00, 0x12, 0x34, 0x56, 0x78, 0xFF, 0xFE, 0x00, 0x00, 0x54, 0x78, 0x44, 0x61, 0x74, 0x61},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "64 bit broadcast",
|
||||||
|
fields: fields{
|
||||||
|
Id: 0x00,
|
||||||
|
Destination: 0xFFFF,
|
||||||
|
BCastRadius: 1,
|
||||||
|
Options: 0,
|
||||||
|
Payload: []byte{0x42, 0x72, 0x6F, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74},
|
||||||
|
},
|
||||||
|
want: []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFE, 0x01, 0x00, 0x42, 0x72, 0x6F, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
@ -46,7 +68,6 @@ func TestParseTxStatusFrame(t *testing.T) {
|
||||||
want *TxStatusFrame
|
want *TxStatusFrame
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
// TODO: Add test cases.
|
|
||||||
{
|
{
|
||||||
name: "wrong packet type",
|
name: "wrong packet type",
|
||||||
args: args{
|
args: args{
|
||||||
|
|
Loading…
Reference in a new issue