You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be easy to test code that is consuming BitReader. For this it should be easy to specify specific sequence of bits in a test.
Prototype:
fntestbits(x:&str) -> BitReader<implRead,implEndianness>{letmut v = Vec::new();{let c = std::io::Cursor::new(&mut v);letmut w = bitstream_io::write::BitWriter::endian(c, bitstream_io::BE{});for b in x.as_bytes(){
w.write_bit(b == &b'1');}while !w.byte_aligned(){
w.write_bit(false);}}let c = std::io::Cursor::new(v);BitReader::endian(c, bitstream_io::BE{})}#[test]fntest(){letmut r = testbits("110");assert_eq!(r.read_bit().unwrap(),true);assert_eq!(r.read_bit().unwrap(),true);assert_eq!(r.read_bit().unwrap(),false);}
The text was updated successfully, but these errors were encountered:
It should be easy to test code that is consuming
BitReader
. For this it should be easy to specify specific sequence of bits in a test.Prototype:
The text was updated successfully, but these errors were encountered: