mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Add simple tests for checking validity of BootData
This commit is contained in:
parent
611f048e94
commit
7a3a836566
2 changed files with 25 additions and 0 deletions
1
resources/tests/valid_boot/ffxivboot.ver
Normal file
1
resources/tests/valid_boot/ffxivboot.ver
Normal file
|
@ -0,0 +1 @@
|
||||||
|
2012.01.01.0000.0000
|
|
@ -4,6 +4,7 @@
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
use crate::blowfish::Blowfish;
|
||||||
|
|
||||||
use crate::patch::{apply_patch, PatchError};
|
use crate::patch::{apply_patch, PatchError};
|
||||||
|
|
||||||
|
@ -56,3 +57,26 @@ impl BootData {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_valid_boot_dir() {
|
||||||
|
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
d.push("resources/tests");
|
||||||
|
d.push("valid_boot");
|
||||||
|
|
||||||
|
assert!(BootData::from_existing(d.as_path().to_str().unwrap()).is_some());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_invalid_boot_dir() {
|
||||||
|
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
d.push("resources/tests");
|
||||||
|
d.push("invalid_boot"); // intentionally missing so it doesn't have a .ver
|
||||||
|
|
||||||
|
assert!(BootData::from_existing(d.as_path().to_str().unwrap()).is_none());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue