Sha256: b6fb9c2361ece6b3c6344d523489d7496b01b99d5b0d889f6b2cadd79151466c

Contents?: true

Size: 1.98 KB

Versions: 55

Compression:

Stored size: 1.98 KB

Contents

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertArrayEquals;

/*
 * version: 1.0.0
 */
public class SpiralMatrixBuilderTest {

    private SpiralMatrixBuilder spiralMatrixBuilder;

    @Before
    public void setUp() {
        spiralMatrixBuilder = new SpiralMatrixBuilder();
    }

    @Test
    public void testEmptySpiral() {
        int[][] expected = {};

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(0));
    }

    @Ignore("Remove to run test")
    @Test
    public void testTrivialSpiral() {
        int[][] expected = {
                {1}
        };

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(1));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSpiralOfSize2() {
        int[][] expected = {
                {1, 2},
                {4, 3}
        };

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(2));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSpiralOfSize3() {
        int[][] expected = {
                {1, 2, 3},
                {8, 9, 4},
                {7, 6, 5}
        };

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(3));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSpiralOfSize4() {
        int[][] expected = {
                { 1,  2,  3,  4},
                {12, 13, 14,  5},
                {11, 16, 15,  6},
                {10,  9,  8,  7}
        };

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(4));
    }

    @Ignore("Remove to run test")
    @Test
    public void testSpiralOfSize5() {
        int[][] expected = {
                { 1,  2,  3,  4,  5},
                {16, 17, 18, 19,  6},
                {15, 24, 25, 20,  7},
                {14, 23, 22, 21,  8},
                {13, 12, 11, 10,  9}
        };

        assertArrayEquals(expected, spiralMatrixBuilder.buildMatrixOfSize(5));
    }

}

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
trackler-2.2.1.25 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.24 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.23 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.22 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.21 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.20 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.19 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.18 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.17 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.16 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.15 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.14 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.13 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.12 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.11 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.10 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.9 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.8 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.7 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java
trackler-2.2.1.6 tracks/java/exercises/spiral-matrix/src/test/java/SpiralMatrixBuilderTest.java