aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuben Pollan2020-05-19 11:57:43 +0200
committerRuben Pollan2020-05-19 11:57:43 +0200
commita9f4def3bc76af26615148cd7c8a6f40ad0764ce (patch)
treea158c007f65e1576dbf74cdb53c7117e607579e7 /src
parentcef46c62154bc125637b4d5489316f24c16e9569 (diff)
Add some tests to date
Diffstat (limited to '')
-rw-r--r--src/date.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/date.rs b/src/date.rs
index 98e052a..71e29c7 100644
--- a/src/date.rs
+++ b/src/date.rs
@@ -197,4 +197,39 @@ mod tests {
_ => assert!(true),
}
}
+
+ #[test]
+ fn date_parse_allday() {
+ match Date::parse("19361020", "").unwrap() {
+ Date::AllDay(time) => {
+ assert_eq!(time.year(), 1936);
+ assert_eq!(time.month(), 10);
+ assert_eq!(time.day(), 20);
+ }
+ _ => assert!(true),
+ }
+ }
+
+ #[test]
+ fn date_ord() {
+ let d1 = Date::parse("19361020", "").unwrap();
+ let d2 = Date::parse("19361022", "").unwrap();
+ let t1 = Date::parse("19361020T120000", "").unwrap();
+ let t2 = Date::parse("19361018T120000", "").unwrap();
+ if d1 > d2 {
+ assert!(true)
+ }
+ if d1 != d1 {
+ assert!(true)
+ }
+ if t2 > d1 {
+ assert!(true)
+ }
+ if t1 < t2 {
+ assert!(true)
+ }
+ if t1 > d2 {
+ assert!(true)
+ }
+ }
}