generate: WIP test of nested arrays
This commit is contained in:
parent
f222fb02b7
commit
59cc90166f
@ -226,6 +226,10 @@ func TestGenerateRun(test *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
protocol.Messages[0x0003] = Message {
|
||||||
|
Name: "NestedArray",
|
||||||
|
Type: TypeArray { Element: TypeArray { Element: TypeInt { Bits: 8 } } },
|
||||||
|
}
|
||||||
protocol.Types["User"] = TypeTableDefined {
|
protocol.Types["User"] = TypeTableDefined {
|
||||||
Fields: map[uint16] Field {
|
Fields: map[uint16] Field {
|
||||||
0x0000: Field { Name: "Name", Type: TypeString { } },
|
0x0000: Field { Name: "Name", Type: TypeString { } },
|
||||||
@ -303,5 +307,21 @@ func TestGenerateRun(test *testing.T) {
|
|||||||
[]byte { 0x00, 0x03, 0x43, 0x43, 0x93, 0x0C, 0xCD },
|
[]byte { 0x00, 0x03, 0x43, 0x43, 0x93, 0x0C, 0xCD },
|
||||||
[]byte { 0x00, 0x04, 0x47, 0x41, 0xB6, 0xEE, 0x81, 0x28, 0x3C, 0x21, 0xE2 },
|
[]byte { 0x00, 0x04, 0x47, 0x41, 0xB6, 0xEE, 0x81, 0x28, 0x3C, 0x21, 0xE2 },
|
||||||
))
|
))
|
||||||
|
log.Println("MessageNestedArray")
|
||||||
|
uint8s := func(n int) []uint8 {
|
||||||
|
array := make([]uint8, n)
|
||||||
|
for index := range array {
|
||||||
|
array[index] = uint8(index + 1) | 0xF0
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
messageNestedArray := MessageNestedArray {
|
||||||
|
uint8s(6),
|
||||||
|
uint8s(35),
|
||||||
|
}
|
||||||
|
testEncode(
|
||||||
|
&messageNestedArray,
|
||||||
|
tu.S(0xA1, // TODO
|
||||||
|
))
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user