UPDATE: Adds a bunch of tests

This commit is contained in:
Nicolás Hatcher
2025-11-25 00:26:49 +01:00
committed by Nicolás Hatcher Andrés
parent 6822505602
commit e61b15655a
28 changed files with 147 additions and 42 deletions

View File

@@ -373,6 +373,45 @@ fn test_xlsx() {
);
}
#[test]
fn test_statistical_xlsx() {
let mut entries = fs::read_dir("tests/statistical/")
.unwrap()
.map(|res| res.map(|e| e.path()))
.collect::<Result<Vec<_>, io::Error>>()
.unwrap();
entries.sort();
let temp_folder = env::temp_dir();
let path = format!("{}", Uuid::new_v4());
let dir = temp_folder.join(path);
fs::create_dir(&dir).unwrap();
let mut is_error = false;
for file_path in entries {
let file_name_str = file_path.file_name().unwrap().to_str().unwrap();
let file_path_str = file_path.to_str().unwrap();
println!("Testing file: {file_path_str}");
if file_name_str.ends_with(".xlsx") && !file_name_str.starts_with('~') {
if let Err(message) = test_file(file_path_str) {
println!("Error with file: '{file_path_str}'");
println!("{message}");
is_error = true;
}
let t = test_load_and_saving(file_path_str, &dir);
if t.is_err() {
println!("Error while load and saving file: {file_path_str}");
is_error = true;
}
} else {
println!("skipping");
}
}
fs::remove_dir_all(&dir).unwrap();
assert!(
!is_error,
"Models were evaluated inconsistently with XLSX data."
);
}
#[test]
fn no_export() {
let mut entries = fs::read_dir("tests/calc_test_no_export/")