l4d2-addon-parser/tests/common/mod.rs

21 lines
No EOL
618 B
Rust

use std::fs::File;
use std::path::PathBuf;
use log::info;
pub fn test_resources_path() -> PathBuf {
PathBuf::from(format!("{}/resources/tests", env!("CARGO_MANIFEST_DIR")))
}
pub fn setup_vpk(test_file: u8) -> File {
let path = test_resources_path().join(format!("test{}.vpk", test_file));
info!("Using test file {:?}", path);
File::open(path).expect("test file missing")
}
pub fn get_addonlist_paths(index: u8) -> (PathBuf, PathBuf) {
(
test_resources_path().join(format!("addonlist{}.txt", index)),
test_resources_path().join(format!("addonlist{}_result.txt", index)),
)
}