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:
parent
363abc67da
commit
cc10ec7bac
1 changed files with 20 additions and 1 deletions
19
src/cmp.rs
19
src/cmp.rs
|
@ -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)]
|
||||
|
@ -74,3 +75,21 @@ impl CMP {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue