|
@ -287,18 +287,17 @@ mod test { |
|
|
struct Test {
|
|
|
struct Test {
|
|
|
a: u32,
|
|
|
a: u32,
|
|
|
b: u16,
|
|
|
b: u16,
|
|
|
c: u16,
|
|
|
|
|
|
|
|
|
#[nodebug]
|
|
|
|
|
|
c: [u8; 0x2000],
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let test = Test {
|
|
|
let test = Test {
|
|
|
a: 123456789,
|
|
|
a: 123456789,
|
|
|
b: 54321,
|
|
|
b: 54321,
|
|
|
c: 9999,
|
|
|
|
|
|
|
|
|
c: [0; 0x2000],
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
let mut bytes = test.as_bytes();
|
|
|
let mut bytes = test.as_bytes();
|
|
|
assert!(bytes == vec![16, 0, 35, 0, 0, 0, 0, 0, 21, 205, 91, 7, 49, 212, 15, 39]);
|
|
|
|
|
|
|
|
|
|
|
|
bytes[2] = 17;
|
|
|
bytes[2] = 17;
|
|
|
let test2 = Test::from_bytes(&bytes);
|
|
|
let test2 = Test::from_bytes(&bytes);
|
|
|
assert!(test2 == Err(PacketParseError::WrongPacketCommand));
|
|
|
assert!(test2 == Err(PacketParseError::WrongPacketCommand));
|
|
|