Added tests

This commit is contained in:
2025-04-19 17:03:10 -04:00
parent 795cc917d2
commit 7bdfa7fbaf

View File

@@ -516,6 +516,56 @@ mod tests {
}
};
}
#[test]
fn test_get_track_total() {
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
let filepath = get_full_path(&dir, &filename).unwrap();
match get_meta(types::Type::TrackCount, &filepath) {
Ok(track_total) => {
let found = track_total == "3";
assert!(found, "Meta information was not found {:?}", track_total);
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
}
Err(err) => {
assert!(false, "Error: File does not exist {:?}", err.to_string());
}
};
}
#[test]
fn test_get_disc_total() {
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
let filepath = get_full_path(&dir, &filename).unwrap();
match get_meta(types::Type::DiscCount, &filepath) {
Ok(disc_total) => {
let found = disc_total == "1";
assert!(found, "Meta information was not found {:?}", disc_total);
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
}
Err(err) => {
assert!(false, "Error: File does not exist {:?}", err.to_string());
}
};
}
}
mod set {