Skip to content

Commit f7f4db1

Browse files
committed
Add test for Weekday::from_u32_mod7
1 parent 459defd commit f7f4db1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/weekday.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ mod tests {
260260
);
261261
}
262262
}
263+
264+
#[test]
265+
fn test_from_u32_mod7() {
266+
for i in 0..=1000 {
267+
assert_eq!(Weekday::from_u32_mod7(i), Weekday::from_u32(i % 7).unwrap());
268+
}
269+
assert_eq!(Weekday::from_u32_mod7(u32::MAX), Weekday::Thu);
270+
}
263271
}
264272

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

0 commit comments

Comments
 (0)