Skip to content

Commit 924b162

Browse files
committed
test: add coverage for floating seconds to human values conversion
1 parent c0453df commit 924b162

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/metadata.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,30 @@ pub struct MediaInfo {
8282
pub creating_library: CreatingLibrary,
8383
pub media: Media,
8484
}
85+
86+
#[test]
87+
fn test_duration_conversion_pad_with_zero_one_hour() {
88+
let input = DurationSeconds {
89+
duration_seconds: 7200.0,
90+
};
91+
92+
assert_eq!(input.duration_human(), "02:00:00");
93+
}
94+
95+
#[test]
96+
fn sample_from_test_file() {
97+
let input = DurationSeconds {
98+
duration_seconds: 149.316,
99+
};
100+
101+
assert_eq!(input.duration_human(), "02:29");
102+
}
103+
104+
#[test]
105+
fn test_duration_conversion_pad_with_zero_no_hour() {
106+
let input = DurationSeconds {
107+
duration_seconds: 360.0,
108+
};
109+
110+
assert_eq!(input.duration_human(), "06:00");
111+
}

0 commit comments

Comments
 (0)