Sha256: dd9f75e7dd0fb5857b6425f4b20daeb0006e6751b9a5e7f010288e85b606d3d1

Contents?: true

Size: 1.4 KB

Versions: 36

Compression:

Stored size: 1.4 KB

Contents

extern crate spiral_matrix;
use spiral_matrix::*;

#[test]
fn empty_spiral() {
    let expected: Vec<Vec<usize>> = Vec::new();
    assert_eq!(spiral_matrix(0), expected);
}

#[test]
#[ignore]
fn size_one_spiral() {
    let mut expected: Vec<Vec<usize>> = Vec::new();
    expected.push(vec![1]);
    assert_eq!(spiral_matrix(1), expected);
}
#[test]
#[ignore]
fn size_two_spiral() {
    let mut expected: Vec<Vec<usize>> = Vec::new();
    expected.push(vec![1, 2]);
    expected.push(vec![4, 3]);
    assert_eq!(spiral_matrix(2), expected);
}

#[test]
#[ignore]
fn size_three_spiral() {
    let mut expected: Vec<Vec<usize>> = Vec::new();
    expected.push(vec![1, 2, 3]);
    expected.push(vec![8, 9, 4]);
    expected.push(vec![7, 6, 5]);
    assert_eq!(spiral_matrix(3), expected);
}
#[test]
#[ignore]
fn size_four_spiral() {
    let mut expected: Vec<Vec<usize>> = Vec::new();
    expected.push(vec![1, 2, 3, 4]);
    expected.push(vec![12, 13, 14, 5]);
    expected.push(vec![11, 16, 15, 6]);
    expected.push(vec![10, 9, 8, 7]);
    assert_eq!(spiral_matrix(4), expected);
}
#[test]
#[ignore]
fn size_five_spiral() {
    let mut expected: Vec<Vec<usize>> = Vec::new();
    expected.push(vec![1, 2, 3, 4, 5]);
    expected.push(vec![16, 17, 18, 19, 6]);
    expected.push(vec![15, 24, 25, 20, 7]);
    expected.push(vec![14, 23, 22, 21, 8]);
    expected.push(vec![13, 12, 11, 10, 9]);
    assert_eq!(spiral_matrix(5), expected);
}

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.179 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.178 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.177 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.176 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.175 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.174 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.173 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.172 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.171 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.170 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.169 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.167 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.166 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.165 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.164 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.163 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.162 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.161 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.160 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs