mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 10:44:07 +02:00
commit
bbce1e5a18
2 changed files with 11 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,
|
||||||
|
|
@ -75,6 +83,7 @@ impl Index<LumpType> for Directories {
|
||||||
#[br(little)]
|
#[br(little)]
|
||||||
#[brw(repr=u32)]
|
#[brw(repr=u32)]
|
||||||
pub enum BspVersion {
|
pub enum BspVersion {
|
||||||
|
Version19 = 19,
|
||||||
Version20 = 20,
|
Version20 = 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue