Sha256: 97880aa95267bb15bfcc3a9751de4cdd8d01284e3fda49f57444c47010747002

Contents?: true

Size: 1.79 KB

Versions: 97

Compression:

Stored size: 1.79 KB

Contents

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

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

public class PascalsTriangleTest {


    @Test
    public void testTriangleWithFourRows() {
        int[][] expectedOutput = new int[][]{
                {1},
                {1, 1},
                {1, 2, 1},
                {1, 3, 3, 1},
        };

        assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(4));
    }

    @Ignore
    @Test
    public void testTriangleWithSixRows() {
        int[][] expectedOutput = new int[][]{
                {1},
                {1, 1},
                {1, 2, 1},
                {1, 3, 3, 1},
                {1, 4, 6, 4, 1},
                {1, 5, 10, 10, 5, 1}
        };

        assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(6));
    }

    @Ignore
    @Test
    public void testExpectEmptyTriangle() {
        int[][] expectedOutput = new int[][]{

        };

        assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(0));
    }

    @Ignore
    @Test
    public void testValidInput() {
        int[][] input = new int[][]{
                {1},
                {1, 1},
                {1, 2, 1},
                {1, 3, 3, 1},
                {1, 4, 6, 4, 1},
        };

        assertEquals(true, PascalsTriangle.isTriangle(input));
    }

    @Ignore
    @Test
    public void testInvalidInput() {
        int[][] input = new int[][]{
                {1},
                {1, 1},
                {1, 2, 1},
                {1, 4, 4, 1},
        };

        assertEquals(false, PascalsTriangle.isTriangle(input));
    }

    @Ignore
    @Test(expected = IllegalArgumentException.class)
    public void testValidatesNotNegativeRows() {
        PascalsTriangle.computeTriangle(-1);
    }
}

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
trackler-2.0.6.41 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.40 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.39 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.38 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.37 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.36 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.35 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.34 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.33 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.32 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.31 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.30 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.29 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.28 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.27 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.26 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.25 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.24 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.23 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java
trackler-2.0.6.22 tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java