1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-24 05:27:45 +00:00

Add invalid data test to CMP

This commit is contained in:
Joshua Goins 2024-04-16 21:43:52 -04:00
parent 363abc67da
commit cc10ec7bac

View file

@ -6,6 +6,7 @@ use std::io::{Cursor, Seek, SeekFrom};
use binrw::BinRead;
use binrw::binrw;
use crate::ByteSpan;
use crate::chardat::CharacterData;
#[binrw]
#[br(little)]
@ -73,4 +74,22 @@ impl CMP {
parameters
})
}
}
}
#[cfg(test)]
mod tests {
use std::fs::read;
use std::path::PathBuf;
use super::*;
#[test]
fn test_invalid() {
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
d.push("resources/tests");
d.push("random");
// Feeding it invalid data should not panic
CMP::from_existing(&read(d).unwrap());
}
}