Sha256: f405ade93dceb684399418ec4b32038f082a74a36f6925e12f2e5c1ea1232f2c
Contents?: true
Size: 1.53 KB
Versions: 58
Compression:
Stored size: 1.53 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
58 entries across 58 versions & 1 rubygems