39 lines
769 B
Rust
39 lines
769 B
Rust
|
#[cfg(test)]
|
||
|
mod exaples {
|
||
|
use day31::time_to_string;
|
||
|
|
||
|
#[test]
|
||
|
fn example1() {
|
||
|
assert_eq!(
|
||
|
time_to_string(5, 47),
|
||
|
Ok(String::from("thirteen minutes to six"))
|
||
|
);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example2() {
|
||
|
assert_eq!(time_to_string(3, 00), Ok(String::from("three o' clock")))
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example3() {
|
||
|
assert_eq!(
|
||
|
time_to_string(7, 15),
|
||
|
Ok(String::from("quarter past seven"))
|
||
|
);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example4() {
|
||
|
assert_eq!(time_to_string(5, 30), Ok(String::from("half past five")));
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn example5() {
|
||
|
assert_eq!(
|
||
|
time_to_string(5, 1),
|
||
|
Ok(String::from("one minute past five"))
|
||
|
);
|
||
|
}
|
||
|
}
|