Sha256: 211f45ecd1ad31d15afb0b93b0eb7247c08c9fc4f2b7a8b8674123341bef8e48

Contents?: true

Size: 1.48 KB

Versions: 212

Compression:

Stored size: 1.48 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/guessing-game.html#generating-a-secret-number
 *
 * In order to use the crate, your solution will need to start with the two following lines
*/
extern crate chrono;
use chrono::*;

#[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

212 entries across 212 versions & 1 rubygems

Version Path
trackler-2.1.0.16 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.15 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.14 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.13 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.12 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.11 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.10 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.9 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.8 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.7 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.6 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.5 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.4 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.3 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.2 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.1 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.0 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.0.8.55 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.0.8.54 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.0.8.53 tracks/rust/exercises/gigasecond/tests/gigasecond.rs