mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 10:34:11 +02:00
write wip
This commit is contained in:
parent
af669d34df
commit
5ec81e168f
4 changed files with 108 additions and 34 deletions
|
|
@ -24,12 +24,13 @@ fn test_roundtrip_encode<
|
|||
>(
|
||||
val: T,
|
||||
) {
|
||||
let mut data = Vec::with_capacity(128);
|
||||
use bitbuffer::{BitReadBuffer, BitReadStream, BitWriteStream, LittleEndian};
|
||||
let mut stream = BitWriteStream::new(LittleEndian);
|
||||
let mut stream = BitWriteStream::new(&mut data, LittleEndian);
|
||||
val.write(&mut stream).unwrap();
|
||||
let pos = stream.bit_len();
|
||||
|
||||
let mut read = BitReadStream::new(BitReadBuffer::new_owned(stream.finish(), LittleEndian));
|
||||
let mut read = BitReadStream::new(BitReadBuffer::new_owned(data, LittleEndian));
|
||||
assert_eq!(val, read.read().unwrap());
|
||||
assert_eq!(pos, read.pos());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue