1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 08:34:07 +02:00

type hints in tests

This commit is contained in:
Robin Appelman 2021-07-27 15:12:42 +02:00
commit 0fe7c04ece
2 changed files with 12 additions and 12 deletions

View file

@ -343,7 +343,7 @@ fn read_sized_trait() {
);
stream.set_pos(0).unwrap();
let mut result: BitReadStream<BigEndian> = stream.read_sized(4).unwrap();
assert_eq!(0b10u8, result.read_int(2).unwrap());
assert_eq!(0b10u8, result.read_int::<u8>(2).unwrap());
}
#[test]
@ -374,7 +374,7 @@ fn read_sized_trait_unchecked() {
);
stream.set_pos(0).unwrap();
let mut result: BitReadStream<BigEndian> = stream.read_sized_unchecked(4, true).unwrap();
assert_eq!(0b10u8, result.read_int(2).unwrap());
assert_eq!(0b10u8, result.read_int::<u8>(2).unwrap());
}
}

View file

@ -62,8 +62,8 @@ fn test_write_bool_number_le() {
let mut read = BitReadStream::from(BitReadBuffer::new(&data, LittleEndian));
assert_eq!(true, read.read_bool().unwrap());
assert_eq!(3253u16, read.read().unwrap());
assert_eq!(13253u64, read.read().unwrap());
assert_eq!(3253u16, read.read::<u16>().unwrap());
assert_eq!(13253u64, read.read::<u64>().unwrap());
// 0 padded
assert_eq!(false, read.read_bool().unwrap());
@ -82,9 +82,9 @@ fn test_write_bool_number_be() {
let mut read = BitReadStream::from(BitReadBuffer::new(&data, BigEndian));
assert_eq!(1u8, read.read_int(1).unwrap());
assert_eq!(3253u16, read.read().unwrap());
assert_eq!(13253u64, read.read().unwrap());
assert_eq!(1u8, read.read_int::<u8>(1).unwrap());
assert_eq!(3253u16, read.read::<u16>().unwrap());
assert_eq!(13253u64, read.read::<u64>().unwrap());
// 0 padded
assert_eq!(false, read.read_bool().unwrap());
@ -103,7 +103,7 @@ fn test_write_float_le() {
let mut read = BitReadStream::from(BitReadBuffer::new(&data, LittleEndian));
assert_eq!(true, read.read_bool().unwrap());
assert_eq!(3253.12f32, read.read().unwrap());
assert_eq!(3253.12f32, read.read::<f32>().unwrap());
// 0 padded
assert_eq!(false, read.read_bool().unwrap());
@ -121,8 +121,8 @@ fn test_write_float_be() {
let mut read = BitReadStream::from(BitReadBuffer::new(&data, BigEndian));
assert_eq!(1u8, read.read_int(1).unwrap());
assert_eq!(3253.12f32, read.read().unwrap());
assert_eq!(1u8, read.read_int::<u8>(1).unwrap());
assert_eq!(3253.12f32, read.read::<f32>().unwrap());
// 0 padded
assert_eq!(false, read.read_bool().unwrap());
@ -183,8 +183,8 @@ fn test_write_signed() {
let mut read = BitReadStream::from(BitReadBuffer::new(&data, LittleEndian));
assert_eq!(true, read.read_bool().unwrap());
assert_eq!(-17i32, read.read_int(32).unwrap());
assert_eq!(-9i32, read.read_int(8).unwrap());
assert_eq!(-17i32, read.read_int::<i32>(32).unwrap());
assert_eq!(-9i32, read.read_int::<i32>(8).unwrap());
}
#[test]