#![deny(warnings)] extern crate flash_mockstream; use std::io::{Read, Write}; use flash_mockstream::MockStream; #[test] fn test_read_write() { let mut mockstream = MockStream::new(); let mut read_buf = [0; 10]; let write_buf = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; let read = mockstream.read(&mut read_buf).unwrap(); assert_eq!(read, 0); let write = mockstream.write(&write_buf).unwrap(); assert_eq!(write, 11); let read = mockstream.read(&mut read_buf).unwrap(); assert_eq!(read, 10); let read = mockstream.read(&mut read_buf).unwrap(); assert_eq!(read, 1); assert_eq!(read_buf[0], 11); }