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.2.0.1 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.0.0 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.55 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.54 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.53 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.52 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.51 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.50 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.49 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.48 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.47 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.46 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.45 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.44 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.43 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.42 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.41 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.40 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.39 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.1.0.38 tracks/rust/exercises/gigasecond/tests/gigasecond.rs