chronologic/relns/
mod.rs

1//! # Time relations
2mod overlap;
3mod ordering;
4mod contain;
5
6pub use overlap::*;
7pub use contain::*;
8
9#[cfg(test)]
10mod tests {
11    use std::fmt::Debug;
12    use crate::*;
13
14
15    fn checktw<T:Debug>(check:&str, x:&T) {
16        assert_eq!( check, &format!("{:?}", x));
17    }
18
19    #[test]
20    fn contains()
21    {
22        let t1 = TimeValue::from_ticks(1);
23        let t5 = TimeValue::from_ticks(5);
24        let t10 = TimeValue::from_ticks(10);
25        let tw10 = TimeSpan::centered(t10, t5).unwrap();
26        let tw = !t1 & !t5 & !tw10;
27        checktw( "]-oo,0]U[2,4]U[16,+oo[", &tw);
28
29        assert!( tw.contains(&TimeValue::from_ticks(3)));
30        assert!( tw.contains(&TimeValue::from_ticks(100)));
31        assert!( tw.contains(&TimeValue::from_ticks(-15)));
32        assert!(!tw.contains(&TimeValue::from_ticks(10)));
33
34        println!("{}", Timestamp::now().format_timepoint("%F %C"));
35    }
36
37}
38