summaryrefslogtreecommitdiffstats
path: root/src/timetype.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-19 17:12:07 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-19 17:12:07 +0200
commit271da28d6dad84faef726cf9c0ea4ff65e17e64b (patch)
treedc41ba5fb23633704b0e5a00f01dbb8a146c9f4c /src/timetype.rs
parent6b9d1d0d37159720f23e4916e29f6f17841ff231 (diff)
Add tests for testing TT::is_a()
Diffstat (limited to 'src/timetype.rs')
-rw-r--r--src/timetype.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs
index 9ab3c46..d406c58 100644
--- a/src/timetype.rs
+++ b/src/timetype.rs
@@ -3509,3 +3509,56 @@ mod test_end_of_minute {
}
+#[cfg(test)]
+mod test_is_a {
+ use super::TimeType as TT;
+ use chrono::NaiveDate as ND;
+ use indicator::Day;
+
+ fn ymd(y: i32, m: u32, d: u32) -> TT {
+ TT::moment(ND::from_ymd(y, m, d).and_hms(0, 0, 0))
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_1() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Monday).unwrap());
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_2() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Tuesday).unwrap());
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_3() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Wednesday).unwrap());
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_4() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Thursday).unwrap());
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_5() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Friday).unwrap());
+ }
+
+ #[test]
+ fn test_is_a_6() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Saturday).unwrap());
+ }
+
+ #[test]
+ #[should_panic(expected = "assertion failed")]
+ fn test_is_a_7() {
+ assert!(ymd(2000, 1, 1).is_a(Day::Sunday).unwrap());
+ }
+
+}
+