Updated libraries and increased test coverage
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
//Matrix/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
|
||||
//Mattrixwv
|
||||
// Created: 02-07-22
|
||||
//Modified: 07-09-22
|
||||
//Modified: 04-13-23
|
||||
package com.mattrixwv.matrix;
|
||||
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
@@ -200,8 +199,8 @@ public class TestDoubleMatrix{
|
||||
public void testEquals(){
|
||||
//Invalid equals
|
||||
DoubleMatrix matrix = new DoubleMatrix(grid1);
|
||||
assertNotEquals(null, matrix);
|
||||
assertNotEquals(new int[0], matrix);
|
||||
assertNotEquals(matrix, null);
|
||||
assertNotEquals(matrix, new int[0]);
|
||||
|
||||
//1x1
|
||||
matrix = new DoubleMatrix(grid1);
|
||||
@@ -1851,4 +1850,38 @@ public class TestDoubleMatrix{
|
||||
String matrixString = "[0.5,1.5,2.5]\n[0.5,1.5,2.5]\n[0.5,1.5,2.5]";
|
||||
assertEquals(matrixString, matrix.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaplaceExpansionHelper(){
|
||||
DoubleMatrixPublic matrix = new DoubleMatrixPublic();
|
||||
matrix.addRow(grid2[0]);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
DoubleMatrixPublic matrix2 = new DoubleMatrixPublic();
|
||||
matrix2.setGrid(grid1);
|
||||
assertThrows(InvalidGeometryException.class, () -> {
|
||||
matrix2.laplaceExpansionHelper(0, 0);
|
||||
});
|
||||
|
||||
DoubleMatrixPublic matrix3 = new DoubleMatrixPublic();
|
||||
matrix3.setGrid(grid2);
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(-1, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(2, 0);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, -1);
|
||||
});
|
||||
assertThrows(InvalidCoordinatesException.class, () -> {
|
||||
matrix3.laplaceExpansionHelper(0, 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class DoubleMatrixPublic extends DoubleMatrix{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user