added a size assertion to the basic example
This commit is contained in:
parent
ed96883a53
commit
00929f29dc
|
|
@ -37,6 +37,8 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
|
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
|
||||||
|
// 8 bytes for the length of the vector, 4 bytes per float.
|
||||||
|
assert_eq!(encoded.len(), 8 + 4 * 4);
|
||||||
let decoded: World = bincode::decode(encoded).unwrap();
|
let decoded: World = bincode::decode(encoded).unwrap();
|
||||||
|
|
||||||
assert!(world == decoded);
|
assert!(world == decoded);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
|
let encoded: Vec<u8> = bincode::encode(&world).unwrap();
|
||||||
|
// 8 bytes for the length of the vector, 4 bytes per float.
|
||||||
|
assert_eq!(encoded.len(), 8 + 4 * 4);
|
||||||
let decoded: World = bincode::decode(encoded).unwrap();
|
let decoded: World = bincode::decode(encoded).unwrap();
|
||||||
|
|
||||||
assert!(world == decoded);
|
assert!(world == decoded);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue