Skip to content

Commit

Permalink
chore: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaznable committed May 26, 2023
1 parent 39fafad commit 6de023a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ pub fn format_timestamp_to_time(ms: i64) -> String {
let milliseconds = ms % 1000;
format!("{:02}:{:02}:{:03}", minutes, seconds, milliseconds)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_format_timestamp_to_time() {
let time = 1000 * 60 * 60 * 3 + 1000 * 60 * 3 + 3;
let result = format_timestamp_to_time(time);
assert_eq!(result, "03:00:003");
}
}

0 comments on commit 6de023a

Please sign in to comment.