Skip to content

Commit 14d6c70

Browse files
committed
MatrixTest, TransposeTest, ZipperTest
1 parent 84c050c commit 14d6c70

File tree

3 files changed

+252
-219
lines changed

3 files changed

+252
-219
lines changed

exercises/practice/matrix/src/test/java/MatrixTest.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
import org.junit.jupiter.api.Disabled;
2+
import org.junit.jupiter.api.DisplayName;
23
import org.junit.jupiter.api.Test;
34

45
import static org.assertj.core.api.Assertions.assertThat;
56

67
public class MatrixTest {
78

89
@Test
10+
@DisplayName("extract row from one number matrix test")
911
public void extractRowFromOneNumberMatrixTest() {
1012
String matrixAsString = "1";
1113
int rowIndex = 1;
12-
int[] expectedRow = {1};
14+
int[] expectedRow = { 1 };
1315

1416
Matrix matrix = new Matrix(matrixAsString);
1517

1618
assertThat(matrix.getRow(rowIndex)).isEqualTo(expectedRow);
1719
}
1820

1921
@Disabled("Remove to run test")
22+
@DisplayName("extract row from matrix test")
2023
@Test
2124
public void extractRowFromMatrixTest() {
2225
String matrixAsString = "1 2\n3 4";
2326
int rowIndex = 2;
24-
int[] expectedRow = {3, 4};
27+
int[] expectedRow = { 3, 4 };
2528

2629
Matrix matrix = new Matrix(matrixAsString);
2730

@@ -30,10 +33,11 @@ public void extractRowFromMatrixTest() {
3033

3134
@Disabled("Remove to run test")
3235
@Test
36+
@DisplayName("extract row from diff widths matrix test")
3337
public void extractRowFromDiffWidthsMatrixTest() {
3438
String matrixAsString = "1 2\n10 20";
3539
int rowIndex = 2;
36-
int[] expectedRow = {10, 20};
40+
int[] expectedRow = { 10, 20 };
3741

3842
Matrix matrix = new Matrix(matrixAsString);
3943

@@ -42,10 +46,11 @@ public void extractRowFromDiffWidthsMatrixTest() {
4246

4347
@Disabled("Remove to run test")
4448
@Test
49+
@DisplayName("extract row from non square matrix test")
4550
public void extractRowFromNonSquareMatrixTest() {
4651
String matrixAsString = "1 2 3\n4 5 6\n7 8 9\n8 7 6";
4752
int rowIndex = 4;
48-
int[] expectedRow = {8, 7, 6};
53+
int[] expectedRow = { 8, 7, 6 };
4954

5055
Matrix matrix = new Matrix(matrixAsString);
5156

@@ -54,10 +59,11 @@ public void extractRowFromNonSquareMatrixTest() {
5459

5560
@Disabled("Remove to run test")
5661
@Test
62+
@DisplayName("extract column from one number matrix test")
5763
public void extractColumnFromOneNumberMatrixTest() {
5864
String matrixAsString = "1";
5965
int columnIndex = 1;
60-
int[] expectedColumn = {1};
66+
int[] expectedColumn = { 1 };
6167

6268
Matrix matrix = new Matrix(matrixAsString);
6369

@@ -66,10 +72,11 @@ public void extractColumnFromOneNumberMatrixTest() {
6672

6773
@Disabled("Remove to run test")
6874
@Test
75+
@DisplayName("extract column matrix test")
6976
public void extractColumnMatrixTest() {
7077
String matrixAsString = "1 2 3\n4 5 6\n7 8 9";
7178
int columnIndex = 3;
72-
int[] expectedColumn = {3, 6, 9};
79+
int[] expectedColumn = { 3, 6, 9 };
7380

7481
Matrix matrix = new Matrix(matrixAsString);
7582

@@ -78,10 +85,11 @@ public void extractColumnMatrixTest() {
7885

7986
@Disabled("Remove to run test")
8087
@Test
88+
@DisplayName("extract column from non square matrix test")
8189
public void extractColumnFromNonSquareMatrixTest() {
8290
String matrixAsString = "1 2 3 4\n5 6 7 8\n9 8 7 6";
8391
int columnIndex = 4;
84-
int[] expectedColumn = {4, 8, 6};
92+
int[] expectedColumn = { 4, 8, 6 };
8593

8694
Matrix matrix = new Matrix(matrixAsString);
8795

@@ -90,10 +98,11 @@ public void extractColumnFromNonSquareMatrixTest() {
9098

9199
@Disabled("Remove to run test")
92100
@Test
101+
@DisplayName("extract column from diff widths matrix test")
93102
public void extractColumnFromDiffWidthsMatrixTest() {
94103
String matrixAsString = "89 1903 3\n18 3 1\n9 4 800";
95104
int columnIndex = 2;
96-
int[] expectedColumn = {1903, 3, 4};
105+
int[] expectedColumn = { 1903, 3, 4 };
97106

98107
Matrix matrix = new Matrix(matrixAsString);
99108

0 commit comments

Comments
 (0)