mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 08:34:07 +02:00
Merge pull request #6 from hussein-aitlahcen/master
fixup: decrement before indexing with `last_mut`
This commit is contained in:
commit
7422800014
4 changed files with 20 additions and 3 deletions
|
|
@ -227,3 +227,19 @@ fn test_write_to_slice() {
|
|||
// 0 padded
|
||||
assert!(!read.read_bool().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_write_last_slice() {
|
||||
let mut data = [0; 1];
|
||||
{
|
||||
let mut stream = BitWriteStream::from_slice(&mut data[..], LittleEndian);
|
||||
|
||||
stream.write_int::<u8>(0b1000, 4).unwrap();
|
||||
stream.write_bool(true).unwrap();
|
||||
}
|
||||
|
||||
let mut read = BitReadStream::from(BitReadBuffer::new(&data[..], LittleEndian));
|
||||
|
||||
assert_eq!(0b1000, read.read_int::<u8>(4).unwrap());
|
||||
assert_eq!(true, read.read_bool().unwrap());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue