Added some tests
Getty Ritter
8 years ago
6 | 6 | bytes: Rd, |
7 | 7 | } |
8 | 8 | |
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 | } | |
10 | 16 | |
11 | 17 | const MK_OK: &'static Fn(io::Result<u8>) -> Option<u8> = &|s| s.ok(); |
12 | 18 |