gdritter repos thermidor / fa4dadb
Added some tests Getty Ritter 8 years ago
1 changed file(s) with 7 addition(s) and 1 deletion(s). Collapse all Expand all
66 bytes: Rd,
77 }
88
9 pub type ByteReaderT = ByteReader<Iterator<Item=u8>>;
9 #[test]
10 fn reader_tests() {
11 assert!(ByteReader::from_vec(vec![0x00]).read_twip() == Ok(-32.0));
12 assert!(ByteReader::from_vec(vec![0x00]).read_prefix_int() == Ok(0x00));
13 assert!(ByteReader::from_vec(vec![0x7f]).read_prefix_int() == Ok(0x7f));
14 assert!(ByteReader::from_vec(vec![0x80,0xff]).read_prefix_int() == Ok(0xff));
15 }
1016
1117 const MK_OK: &'static Fn(io::Result<u8>) -> Option<u8> = &|s| s.ok();
1218