1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
use chrono::{TimeZone, Utc};
#[test]
fn test_date() {
let start_date = Utc.ymd(2011, 4, 25).and_hms(0, 0, 0);
assert_eq!(
gigasecond::after(start_date),
Utc.ymd(2043, 1, 1).and_hms(1, 46, 40)
);
}
#[test]
fn test_another_date() {
let start_date = Utc.ymd(1977, 6, 13).and_hms(0, 0, 0);
assert_eq!(
gigasecond::after(start_date),
Utc.ymd(2009, 2, 19).and_hms(1, 46, 40)
);
}
#[test]
fn test_third_date() {
let start_date = Utc.ymd(1959, 7, 19).and_hms(0, 0, 0);
assert_eq!(
gigasecond::after(start_date),
Utc.ymd(1991, 3, 27).and_hms(1, 46, 40)
);
}
#[test]
fn test_datetime() {
let start_date = Utc.ymd(2015, 1, 24).and_hms(22, 0, 0);
assert_eq!(
gigasecond::after(start_date),
Utc.ymd(2046, 10, 2).and_hms(23, 46, 40)
);
}
#[test]
fn test_another_datetime() {
let start_date = Utc.ymd(2015, 1, 24).and_hms(23, 59, 59);
assert_eq!(
gigasecond::after(start_date),
Utc.ymd(2046, 10, 3).and_hms(1, 46, 39)
);
}
|