mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
bunch of write stuff
This commit is contained in:
parent
4d2ea4ee7c
commit
23ed7b0e4a
12 changed files with 840 additions and 116 deletions
|
|
@ -118,6 +118,22 @@ fn test_write_float_be() {
|
|||
fn test_write_string_le() {
|
||||
let mut stream = BitWriteStream::new(LittleEndian);
|
||||
|
||||
stream.write_string("null terminated", None).unwrap();
|
||||
stream.write_string("fixed length1", Some(16)).unwrap();
|
||||
stream.write_string("fixed length2", Some(16)).unwrap();
|
||||
|
||||
let data = stream.finish();
|
||||
let mut read = BitReadStream::from(BitReadBuffer::new(&data, LittleEndian));
|
||||
|
||||
assert_eq!("null terminated", read.read_string(None).unwrap());
|
||||
assert_eq!("fixed length1", read.read_string(Some(16)).unwrap());
|
||||
assert_eq!("fixed length2", read.read_string(Some(16)).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_write_string_le_unaligned() {
|
||||
let mut stream = BitWriteStream::new(LittleEndian);
|
||||
|
||||
stream.write_bool(true).unwrap();
|
||||
stream.write_string("null terminated", None).unwrap();
|
||||
stream.write_string("fixed length1", Some(16)).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue