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.159 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.158 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.157 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.156 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.155 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.154 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.153 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.152 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.151 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.150 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.149 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.148 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.147 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.146 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.145 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs
trackler-2.2.1.144 tracks/rust/exercises/spiral-matrix/tests/spiral-matrix.rs