|
|
@@ -1,13 +1,13 @@
|
|
1
|
1
|
import org.junit.Ignore;
|
|
2
|
2
|
import org.junit.Test;
|
|
3
|
3
|
|
|
4
|
|
-import java.util.ArrayList;
|
|
5
|
|
-import java.util.Arrays;
|
|
6
|
|
-import java.util.Collections;
|
|
7
|
|
-import java.util.List;
|
|
|
4
|
+import java.util.*;
|
|
8
|
5
|
|
|
9
|
6
|
import static org.junit.Assert.assertEquals;
|
|
10
|
7
|
|
|
|
8
|
+/*
|
|
|
9
|
+ * version: 1.0.0
|
|
|
10
|
+ */
|
|
11
|
11
|
public class MatrixTest {
|
|
12
|
12
|
|
|
13
|
13
|
@Test
|
|
|
@@ -18,7 +18,7 @@ public class MatrixTest {
|
|
18
|
18
|
Arrays.asList(6, 6, 7)
|
|
19
|
19
|
));
|
|
20
|
20
|
|
|
21
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(1, 0));
|
|
|
21
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(1, 0));
|
|
22
|
22
|
|
|
23
|
23
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
24
|
24
|
}
|
|
|
@@ -28,7 +28,7 @@ public class MatrixTest {
|
|
28
|
28
|
public void testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {
|
|
29
|
29
|
Matrix matrix = new Matrix(new ArrayList<>());
|
|
30
|
30
|
|
|
31
|
|
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
|
|
|
31
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
|
|
32
|
32
|
|
|
33
|
33
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
34
|
34
|
}
|
|
|
@@ -42,7 +42,7 @@ public class MatrixTest {
|
|
42
|
42
|
Arrays.asList(2, 3, 1)
|
|
43
|
43
|
));
|
|
44
|
44
|
|
|
45
|
|
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
|
|
|
45
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
|
|
46
|
46
|
|
|
47
|
47
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
48
|
48
|
}
|
|
|
@@ -56,11 +56,11 @@ public class MatrixTest {
|
|
56
|
56
|
Arrays.asList(1, 5, 4)
|
|
57
|
57
|
));
|
|
58
|
58
|
|
|
59
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Arrays.asList(
|
|
|
59
|
+ Set<MatrixCoordinate> expectedSaddlePoints = new HashSet<>(Arrays.asList(
|
|
60
|
60
|
new MatrixCoordinate(0, 1),
|
|
61
|
61
|
new MatrixCoordinate(1, 1),
|
|
62
|
62
|
new MatrixCoordinate(2, 1)
|
|
63
|
|
- );
|
|
|
63
|
+ ));
|
|
64
|
64
|
|
|
65
|
65
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
66
|
66
|
}
|
|
|
@@ -74,7 +74,7 @@ public class MatrixTest {
|
|
74
|
74
|
Arrays.asList(3, 2, 5)
|
|
75
|
75
|
));
|
|
76
|
76
|
|
|
77
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(2, 2));
|
|
|
77
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(2, 2));
|
|
78
|
78
|
|
|
79
|
79
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
80
|
80
|
}
|