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