diff options
-rw-r--r-- | src/iter.rs | 70 | ||||
-rw-r--r-- | src/lib.rs | 14 | ||||
-rw-r--r-- | tests/rrule.rs | 72 |
3 files changed, 84 insertions, 72 deletions
diff --git a/src/iter.rs b/src/iter.rs index 4f2c206..026ae31 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -13,11 +13,11 @@ pub enum QueryMethodTypes { } pub struct IterArgs { - inc: bool, - before: DateTime<Utc>, - after: DateTime<Utc>, - dt: DateTime<Utc>, - _value: Option<Vec<DateTime<Utc>>>, + pub inc: bool, + pub before: DateTime<Utc>, + pub after: DateTime<Utc>, + pub dt: DateTime<Utc>, + pub _value: Option<Vec<DateTime<Utc>>>, } pub struct IterResult { @@ -382,63 +382,3 @@ pub fn make_timeset( counter_date.timestamp_subsec_millis() as usize, ); } - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn int_works() { - let iter_args = IterArgs { - inc: true, - before: Utc::now(), - after: Utc::now(), - dt: Utc::now(), - _value: Some(vec![]), - }; - let mut iter_res = IterResult::new(QueryMethodTypes::ALL, iter_args); - let mut options = ParsedOptions { - freq: Frequenzy::DAILY, - dtstart: Utc.ymd(2012, 1, 1).and_hms(10, 30, 0), - until: Some(Utc.ymd(2012, 12, 31).and_hms(10, 30, 0)), - tzid: None, - interval: 1, - wkst: 0, - count: None, - bysecond: vec![0], - byminute: vec![30], - byhour: vec![10], - bymonth: vec![], - bymonthday: vec![], - bysetpos: vec![], - byweekno: vec![], - byyearday: vec![], - byweekday: vec![0, 1, 2, 3, 4, 5, 6], - bynweekday: vec![], - bynmonthday: vec![], - }; - let mut options_2 = ParsedOptions { - freq: Frequenzy::WEEKLY, - dtstart: Utc.ymd(2012, 1, 1).and_hms(10, 30, 0), - until: None, - //until: Some(Utc.ymd(2012, 12, 31).and_hms(10, 30, 0)), - tzid: None, - interval: 5, - wkst: 0, - count: Some(5), - bysecond: vec![0], - byminute: vec![30], - byhour: vec![10], - bymonth: vec![6], - bymonthday: vec![], - bysetpos: vec![], - byweekno: vec![], - byyearday: vec![], - byweekday: vec![0, 4], - bynweekday: vec![], - bynmonthday: vec![], - }; - let res = iter(&mut iter_res, &mut options); - println!("Res: {:?}", res); - } -} @@ -1,9 +1,9 @@ extern crate chrono; -mod datetime; -mod iter; -mod iterinfo; -mod masks; -mod monthinfo; -mod poslist; -mod yearinfo; +pub mod datetime; +pub mod iter; +pub mod iterinfo; +pub mod masks; +pub mod monthinfo; +pub mod poslist; +pub mod yearinfo; diff --git a/tests/rrule.rs b/tests/rrule.rs new file mode 100644 index 0000000..512e217 --- /dev/null +++ b/tests/rrule.rs @@ -0,0 +1,72 @@ +extern crate chrono; +extern crate rust_ical; + +use chrono::prelude::*; +use chrono::*; +use rust_ical::iter::*; +use rust_ical::yearinfo::*; + +#[cfg(test)] +mod test { + use super::*; + + fn test_recurring(msg: &str, options: &ParsedOptions, expected_dates: &DateTime<Utc>) { + assert_eq!(2, 2, "{}", msg); + } + + #[test] + fn int_works() { + let iter_args = IterArgs { + inc: true, + before: Utc::now(), + after: Utc::now(), + dt: Utc::now(), + _value: Some(vec![]), + }; + let mut iter_res = IterResult::new(QueryMethodTypes::ALL, iter_args); + let mut options = ParsedOptions { + freq: Frequenzy::DAILY, + dtstart: Utc.ymd(2012, 1, 1).and_hms(10, 30, 0), + until: Some(Utc.ymd(2012, 12, 31).and_hms(10, 30, 0)), + tzid: None, + interval: 1, + wkst: 0, + count: None, + bysecond: vec![0], + byminute: vec![30], + byhour: vec![10], + bymonth: vec![], + bymonthday: vec![], + bysetpos: vec![], + byweekno: vec![], + byyearday: vec![], + byweekday: vec![0, 1, 2, 3, 4, 5, 6], + bynweekday: vec![], + bynmonthday: vec![], + }; + let mut options_2 = ParsedOptions { + freq: Frequenzy::WEEKLY, + dtstart: Utc.ymd(2012, 1, 1).and_hms(10, 30, 0), + until: None, + //until: Some(Utc.ymd(2012, 12, 31).and_hms(10, 30, 0)), + tzid: None, + interval: 5, + wkst: 0, + count: Some(5), + bysecond: vec![0], + byminute: vec![30], + byhour: vec![10], + bymonth: vec![6], + bymonthday: vec![], + bysetpos: vec![], + byweekno: vec![], + byyearday: vec![], + byweekday: vec![0, 4], + bynweekday: vec![], + bynmonthday: vec![], + }; + let res = iter(&mut iter_res, &mut options); + assert!(false); + println!("Res: {:?}", res); + } +} |