1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use ;
// TODO: fix this test
// #[test]
// fn decode_startdata() {
// let bytes: Vec<u8> = Vec::from([0, 0]);
// let ver = AnyBlock::decode_one(EncodingVersion::Version1, &mut bytes.into_iter()).unwrap();
// assert_eq!(
// ver,
// AnyBlock::StartData(StartData(EncodingVersion::Version1)),
// "Expected StartData(EncodingVersion::Version1), got {:?}",
// ver
// );
// }
// #[test]
// fn decode_bad_startdata() {
// let bytes: Vec<u8> = Vec::from([0, 255]);
// let ver = AnyBlock::decode_one(EncodingVersion::Version1, &mut bytes.into_iter());
// match ver {
// Ok(_) => panic!("Expected an error"),
// Err(e) => match e.error {
// DecodeError::UnknownVersion(d) => assert_eq!(d.0, 255),
// _ => panic!("Expected an UnknownVersion error, got {:?}", e),
// },
// }
// }