Skip to content

Commit

Permalink
Add test for Weekday::from_u32_mod7
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Apr 30, 2023
1 parent 459defd commit f7f4db1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/weekday.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ mod tests {
);
}
}

#[test]
fn test_from_u32_mod7() {
for i in 0..=1000 {
assert_eq!(Weekday::from_u32_mod7(i), Weekday::from_u32(i % 7).unwrap());
}
assert_eq!(Weekday::from_u32_mod7(u32::MAX), Weekday::Thu);
}
}

// the actual `FromStr` implementation is in the `format` module to leverage the existing code
Expand Down

0 comments on commit f7f4db1

Please sign in to comment.