From 0c3e4bf82a7431f1ef19e5a4b9edec21d8bd10a8 Mon Sep 17 00:00:00 2001 From: phoenix Date: Tue, 21 Oct 2025 21:02:11 -0400 Subject: [PATCH] tsk-45: Added test --- src/detection/song.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/detection/song.rs b/src/detection/song.rs index 53f791e..e031aea 100644 --- a/src/detection/song.rs +++ b/src/detection/song.rs @@ -64,4 +64,22 @@ mod tests { } } } + + #[test] + fn test_song_file_type_from_data() { + let directory = String::from(crate::test_util::util::TESTFILEDIRECTORY); + let filename = String::from("track01.flac"); + let filepath = format!("{directory}/{filename}"); + let data = crate::test_util::util::get_data_from_file(&filepath).unwrap(); + + match super::file_type_from_data(&data) { + Ok(filetype) => { + assert_eq!(filetype.file_type, crate::detection::song::constants::FLAC_TYPE, "Types do not match") + } + Err(err) => { + assert!(false, "Error: {err:?}") + } + } + } + }