Sha256: 4c4cf3de0fafdab0141079db2870e3727ff39fdc07c9542e3474b14d620f0ad5

Contents?: true

Size: 1.52 KB

Versions: 67

Compression:

Stored size: 1.52 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::*;

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

67 entries across 67 versions & 1 rubygems

Version Path
trackler-2.2.1.111 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.110 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.109 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.108 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.107 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.106 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.105 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.104 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.103 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.102 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.101 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.100 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.99 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.98 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.97 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.96 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.95 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.94 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.93 tracks/rust/exercises/gigasecond/tests/gigasecond.rs
trackler-2.2.1.92 tracks/rust/exercises/gigasecond/tests/gigasecond.rs