mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 10:44:07 +02:00
pass lump version in test_static_prop_lump_bytes
This commit is contained in:
parent
6e3c0659cb
commit
c31dfda436
2 changed files with 10 additions and 2 deletions
|
|
@ -227,7 +227,7 @@ struct RawStaticPropLump {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_static_prop_lump_bytes() {
|
fn test_static_prop_lump_bytes() {
|
||||||
super::test_read_bytes::<RawStaticPropLump>();
|
super::test_read_bytes_args::<RawStaticPropLump>((10,));
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RawStaticPropLump> for StaticPropLump {
|
impl From<RawStaticPropLump> for StaticPropLump {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,14 @@ fn test_read_bytes<T: BinRead>()
|
||||||
where
|
where
|
||||||
T::Args<'static>: Default,
|
T::Args<'static>: Default,
|
||||||
<T as BinRead>::Args<'static>: Clone,
|
<T as BinRead>::Args<'static>: Clone,
|
||||||
|
{
|
||||||
|
test_read_bytes_args::<T>(T::Args::default())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn test_read_bytes_args<T: BinRead>(args: T::Args<'static>)
|
||||||
|
where
|
||||||
|
<T as BinRead>::Args<'static>: Clone,
|
||||||
{
|
{
|
||||||
use binrw::BinReaderExt;
|
use binrw::BinReaderExt;
|
||||||
use std::any::type_name;
|
use std::any::type_name;
|
||||||
|
|
@ -48,7 +56,7 @@ where
|
||||||
let bytes = [0; 512];
|
let bytes = [0; 512];
|
||||||
let mut reader = Cursor::new(bytes);
|
let mut reader = Cursor::new(bytes);
|
||||||
|
|
||||||
let _ = reader.read_le::<T>().unwrap();
|
let _ = reader.read_le_args::<T>(args).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
reader.position() as usize,
|
reader.position() as usize,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue