diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-09-19 17:14:53 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-09-19 17:14:53 +0200 |
commit | 7a2a81e06b23d7c5607c3bfda608ab49782f0827 (patch) | |
tree | c42da79944db5665695d76006c498d5c0b8dfbc2 /src/timetype.rs | |
parent | 271da28d6dad84faef726cf9c0ea4ff65e17e64b (diff) |
Add tests to test TT::is_in()
Diffstat (limited to 'src/timetype.rs')
-rw-r--r-- | src/timetype.rs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs index d406c58..f9e50fa 100644 --- a/src/timetype.rs +++ b/src/timetype.rs @@ -3562,3 +3562,86 @@ mod test_is_a { } +#[cfg(test)] +mod test_is_in { + use super::TimeType as TT; + use chrono::NaiveDate as ND; + use indicator::Month; + + fn ymd(y: i32, m: u32, d: u32) -> TT { + TT::moment(ND::from_ymd(y, m, d).and_hms(0, 0, 0)) + } + + #[test] + fn test_is_in_1() { + assert!(ymd(2000, 1, 1).is_in(Month::January).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_2() { + assert!(ymd(2000, 1, 1).is_in(Month::February).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_3() { + assert!(ymd(2000, 1, 1).is_in(Month::March).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_4() { + assert!(ymd(2000, 1, 1).is_in(Month::April).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_5() { + assert!(ymd(2000, 1, 1).is_in(Month::May).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_6() { + assert!(ymd(2000, 1, 1).is_in(Month::June).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_7() { + assert!(ymd(2000, 1, 1).is_in(Month::July).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_8() { + assert!(ymd(2000, 1, 1).is_in(Month::August).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_9() { + assert!(ymd(2000, 1, 1).is_in(Month::September).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_10() { + assert!(ymd(2000, 1, 1).is_in(Month::October).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_11() { + assert!(ymd(2000, 1, 1).is_in(Month::November).unwrap()); + } + + #[test] + #[should_panic(expected = "assertion failed")] + fn test_is_in_12() { + assert!(ymd(2000, 1, 1).is_in(Month::December).unwrap()); + } + +} + |