Sha256: 5972492edd2f3a38644dbe1a2d539e0b47d35f155ec11c6b883db840d95a83b0
Contents?: true
Size: 1.66 KB
Versions: 9
Compression:
Stored size: 1.66 KB
Contents
extern crate gigasecond; /* * Students, * * Rust does not currently have a library for handling Time. To solve this exercise * you'll need to use the Chrono 'crate' (which is Rust's term for an external library). * * The first time you run `cargo test`, the Chrono crate will automatically be downloaded * and installed. More information on crates can be found at * https://doc.rust-lang.org/book/second-edition/ch02-00-guessing-game-tutorial.html#generating-a-random-number * * In order to use the crate, your solution will need to start with the two following lines */ extern crate chrono; 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] #[ignore] 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] #[ignore] 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] #[ignore] 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] #[ignore] 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) ); }
Version data entries
9 entries across 9 versions & 1 rubygems