|
|
@@ -75,6 +75,54 @@ public class PascalsTriangleGeneratorTest {
|
|
75
|
75
|
|
|
76
|
76
|
@Ignore("Remove to run test")
|
|
77
|
77
|
@Test
|
|
|
78
|
+ public void testTriangleWithFiveRows() {
|
|
|
79
|
+ int[][] expectedOutput = new int[][]{
|
|
|
80
|
+ {1},
|
|
|
81
|
+ {1, 1},
|
|
|
82
|
+ {1, 2, 1},
|
|
|
83
|
+ {1, 3, 3, 1},
|
|
|
84
|
+ {1, 4, 6, 4, 1}
|
|
|
85
|
+ };
|
|
|
86
|
+
|
|
|
87
|
+ assertArrayEquals(expectedOutput, pascalsTriangleGenerator.generateTriangle(5));
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
|
90
|
+ @Ignore("Remove to run test")
|
|
|
91
|
+ @Test
|
|
|
92
|
+ public void testTriangleWithSixRows() {
|
|
|
93
|
+ int[][] expectedOutput = new int[][]{
|
|
|
94
|
+ {1},
|
|
|
95
|
+ {1, 1},
|
|
|
96
|
+ {1, 2, 1},
|
|
|
97
|
+ {1, 3, 3, 1},
|
|
|
98
|
+ {1, 4, 6, 4, 1},
|
|
|
99
|
+ {1, 5, 10, 10, 5, 1}
|
|
|
100
|
+ };
|
|
|
101
|
+
|
|
|
102
|
+ assertArrayEquals(expectedOutput, pascalsTriangleGenerator.generateTriangle(6));
|
|
|
103
|
+ }
|
|
|
104
|
+
|
|
|
105
|
+ @Ignore("Remove to run test")
|
|
|
106
|
+ @Test
|
|
|
107
|
+ public void testTriangleWithTenRows() {
|
|
|
108
|
+ int[][] expectedOutput = new int[][]{
|
|
|
109
|
+ {1},
|
|
|
110
|
+ {1, 1},
|
|
|
111
|
+ {1, 2, 1},
|
|
|
112
|
+ {1, 3, 3, 1},
|
|
|
113
|
+ {1, 4, 6, 4, 1},
|
|
|
114
|
+ {1, 5, 10, 10, 5, 1},
|
|
|
115
|
+ {1, 6, 15, 20, 15, 6, 1},
|
|
|
116
|
+ {1, 7, 21, 35, 35, 21, 7, 1},
|
|
|
117
|
+ {1, 8, 28, 56, 70, 56, 28, 8, 1},
|
|
|
118
|
+ {1, 9, 36, 84, 126, 126, 84, 36, 9, 1}
|
|
|
119
|
+ };
|
|
|
120
|
+
|
|
|
121
|
+ assertArrayEquals(expectedOutput, pascalsTriangleGenerator.generateTriangle(10));
|
|
|
122
|
+ }
|
|
|
123
|
+
|
|
|
124
|
+ @Ignore("Remove to run test")
|
|
|
125
|
+ @Test
|
|
78
|
126
|
public void testValidatesNotNegativeRows() {
|
|
79
|
127
|
expectedException.expect(IllegalArgumentException.class);
|
|
80
|
128
|
pascalsTriangleGenerator.generateTriangle(-1);
|