aboutsummaryrefslogtreecommitdiff
path: root/rust/gigasecond/tests
diff options
context:
space:
mode:
Diffstat (limited to 'rust/gigasecond/tests')
-rw-r--r--rust/gigasecond/tests/gigasecond.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/rust/gigasecond/tests/gigasecond.rs b/rust/gigasecond/tests/gigasecond.rs
new file mode 100644
index 0000000..4fe139b
--- /dev/null
+++ b/rust/gigasecond/tests/gigasecond.rs
@@ -0,0 +1,51 @@
1use chrono::{TimeZone, Utc};
2
3#[test]
4fn test_date() {
5 let start_date = Utc.ymd(2011, 4, 25).and_hms(0, 0, 0);
6
7 assert_eq!(
8 gigasecond::after(start_date),
9 Utc.ymd(2043, 1, 1).and_hms(1, 46, 40)
10 );
11}
12
13#[test]
14fn test_another_date() {
15 let start_date = Utc.ymd(1977, 6, 13).and_hms(0, 0, 0);
16
17 assert_eq!(
18 gigasecond::after(start_date),
19 Utc.ymd(2009, 2, 19).and_hms(1, 46, 40)
20 );
21}
22
23#[test]
24fn test_third_date() {
25 let start_date = Utc.ymd(1959, 7, 19).and_hms(0, 0, 0);
26
27 assert_eq!(
28 gigasecond::after(start_date),
29 Utc.ymd(1991, 3, 27).and_hms(1, 46, 40)
30 );
31}
32
33#[test]
34fn test_datetime() {
35 let start_date = Utc.ymd(2015, 1, 24).and_hms(22, 0, 0);
36
37 assert_eq!(
38 gigasecond::after(start_date),
39 Utc.ymd(2046, 10, 2).and_hms(23, 46, 40)
40 );
41}
42
43#[test]
44fn test_another_datetime() {
45 let start_date = Utc.ymd(2015, 1, 24).and_hms(23, 59, 59);
46
47 assert_eq!(
48 gigasecond::after(start_date),
49 Utc.ymd(2046, 10, 3).and_hms(1, 46, 39)
50 );
51}