1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-20 11:47:46 +00:00

Add invalid data test for Index/Index2

This commit is contained in:
Joshua Goins 2024-04-16 21:54:56 -04:00
parent cfe08de0d7
commit f460f5b944

View file

@ -161,3 +161,30 @@ impl Index2File {
self.entries.iter().find(|s| s.hash == hash)
}
}
#[cfg(test)]
mod tests {
use std::path::PathBuf;
use super::*;
#[test]
fn test_index_invalid() {
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
d.push("resources/tests");
d.push("random");
// Feeding it invalid data should not panic
IndexFile::from_existing(d.to_str().unwrap());
}
#[test]
fn test_index2_invalid() {
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
d.push("resources/tests");
d.push("random");
// Feeding it invalid data should not panic
Index2File::from_existing(d.to_str().unwrap());
}
}