Update test coverage

This commit is contained in:
2023-06-30 21:41:03 -04:00
parent 96fec9d7c2
commit 7efca4a154
9 changed files with 88 additions and 56 deletions

View File

@@ -1,7 +1,7 @@
//Matrix/src/main/java/com/mattrixwv/BigIntegerMatrix.java
//Mattrixwv
// Created: 02-10-22
//Modified: 06-30-22
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -68,14 +68,14 @@ public class BigIntegerMatrix{
}
//Returns a matrix with the supplied row and column removed
protected BigIntegerMatrix laplaceExpansionHelper(int row, int col){
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the matrix is large enough to have this operation performed
if((getNumRows() <= 1) || (getNumCols() <= 1)){
throw new InvalidGeometryException("A matrix must be at least 2x2 for you to perform Laplace Expansion: " + getNumRows() + "x" + getNumCols());
}
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the row is valid
if((row < 0) || (row >= getNumRows())){
throw new InvalidCoordinatesException("An invalid row number was supplied: " + row + ". The matrix contains " + getNumRows() + " rows");

View File

@@ -1,7 +1,7 @@
//Matrix/src/main/java/com/mattrixwv/matrix/DoubleMatrix.java
//Mattrixwv
// Created: 02-07-22
//Modified: 06-30-22
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -68,14 +68,14 @@ public class DoubleMatrix{
}
//Returns a matrix with the supplied row and column removed
protected DoubleMatrix laplaceExpansionHelper(int row, int col){
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the matrix is large enough to have this operation performed
if((getNumRows() <= 1) || (getNumCols() <= 1)){
throw new InvalidGeometryException("A matrix must be at least 2x2 for you to perform Laplace Expansion: " + getNumRows() + "x" + getNumCols());
}
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the row is valid
if((row < 0) || (row >= getNumRows())){
throw new InvalidCoordinatesException("An invalid row number was supplied: " + row + ". The matrix contains " + getNumRows() + " rows");

View File

@@ -1,7 +1,7 @@
//Matrix/src/main/java/com/mattrixwv/IntegerMatrix.java
//Mattrixwv
// Created: 02-01-22
//Modified: 06-30-22
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -67,14 +67,14 @@ public class IntegerMatrix{
}
//Returns a matrix with the supplied row and column removed
protected IntegerMatrix laplaceExpansionHelper(int row, int col){
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the matrix is large enough to have this operation performed
if((getNumRows() <= 1) || (getNumCols() <= 1)){
throw new InvalidGeometryException("A matrix must be at least 2x2 for you to perform Laplace Expansion: " + getNumRows() + "x" + getNumCols());
}
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the row is valid
if((row < 0) || (row >= getNumRows())){
throw new InvalidCoordinatesException("An invalid row number was supplied: " + row + ". The matrix contains " + getNumRows() + " rows");

View File

@@ -1,7 +1,7 @@
//Matrix/src/main/java/com/mattrixwv/matrix/LongMatrix.java
//Mattrixwv
// Created: 02-10-22
//Modified: 07-01-22
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -67,14 +67,14 @@ public class LongMatrix{
}
//Returns a matrix with the supplied row and column removed
protected LongMatrix laplaceExpansionHelper(int row, int col){
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the matrix is large enough to have this operation performed
if((getNumRows() <= 1) || (getNumCols() <= 1)){
throw new InvalidGeometryException("A matrix must be at least 2x2 for you to perform Laplace Expansion: " + getNumRows() + "x" + getNumCols());
}
//Make sure the matrix is square
if(!isSquare()){
throw new InvalidGeometryException("A matrix must be square for you to perform Laplace Expansion");
}
//Make sure the row is valid
if((row < 0) || (row >= getNumRows())){
throw new InvalidCoordinatesException("An invalid row number was supplied: " + row + ". The matrix contains " + getNumRows() + " rows");

View File

@@ -1,7 +1,7 @@
//Matrix/src/test/java/com/mattrixwv/matrix/TestBigBigIntegerMatrix.java
//Mattrixwv
// Created: 02-10-22
//Modified: 04-13-23
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -1861,19 +1861,19 @@ public class TestBigIntegerMatrix{
@Test
public void testLaplaceExpansionHelper(){
BigIntegerMatrixPublic matrix = new BigIntegerMatrixPublic();
BigIntegerMatrix matrix = new BigIntegerMatrix();
matrix.addRow(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
});
BigIntegerMatrixPublic matrix2 = new BigIntegerMatrixPublic();
BigIntegerMatrix matrix2 = new BigIntegerMatrix();
matrix2.setGrid(grid1);
assertThrows(InvalidGeometryException.class, () -> {
matrix2.laplaceExpansionHelper(0, 0);
});
BigIntegerMatrixPublic matrix3 = new BigIntegerMatrixPublic();
BigIntegerMatrix matrix3 = new BigIntegerMatrix();
matrix3.setGrid(grid2);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(-1, 0);
@@ -1887,9 +1887,16 @@ public class TestBigIntegerMatrix{
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(0, 2);
});
}
private class BigIntegerMatrixPublic extends BigIntegerMatrix{
BigIntegerMatrix matrix4 = new BigIntegerMatrix();
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
matrix4.addCol(grid2[1]);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
}
}

View File

@@ -1,7 +1,7 @@
//Matrix/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
//Mattrixwv
// Created: 02-07-22
//Modified: 04-13-23
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -1853,19 +1853,19 @@ public class TestDoubleMatrix{
@Test
public void testLaplaceExpansionHelper(){
DoubleMatrixPublic matrix = new DoubleMatrixPublic();
DoubleMatrix matrix = new DoubleMatrix();
matrix.addRow(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
});
DoubleMatrixPublic matrix2 = new DoubleMatrixPublic();
DoubleMatrix matrix2 = new DoubleMatrix();
matrix2.setGrid(grid1);
assertThrows(InvalidGeometryException.class, () -> {
matrix2.laplaceExpansionHelper(0, 0);
});
DoubleMatrixPublic matrix3 = new DoubleMatrixPublic();
DoubleMatrix matrix3 = new DoubleMatrix();
matrix3.setGrid(grid2);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(-1, 0);
@@ -1879,9 +1879,16 @@ public class TestDoubleMatrix{
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(0, 2);
});
}
private class DoubleMatrixPublic extends DoubleMatrix{
DoubleMatrix matrix4 = new DoubleMatrix();
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
matrix4.addCol(grid2[1]);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
}
}

View File

@@ -1,7 +1,7 @@
//Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
//Mattrixwv
// Created: 02-01-22
//Modified: 04-13-23
//Modified: 06-30-23
package com.mattrixwv.matrix;
@@ -1852,19 +1852,19 @@ public class TestIntegerMatrix{
@Test
public void testLaplaceExpansionHelper(){
IntegerMatrixPublic matrix = new IntegerMatrixPublic();
IntegerMatrix matrix = new IntegerMatrix();
matrix.addRow(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
});
IntegerMatrixPublic matrix2 = new IntegerMatrixPublic();
IntegerMatrix matrix2 = new IntegerMatrix();
matrix2.setGrid(grid1);
assertThrows(InvalidGeometryException.class, () -> {
matrix2.laplaceExpansionHelper(0, 0);
});
IntegerMatrixPublic matrix3 = new IntegerMatrixPublic();
IntegerMatrix matrix3 = new IntegerMatrix();
matrix3.setGrid(grid2);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(-1, 0);
@@ -1878,9 +1878,16 @@ public class TestIntegerMatrix{
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(0, 2);
});
}
private class IntegerMatrixPublic extends IntegerMatrix{
IntegerMatrix matrix4 = new IntegerMatrix();
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
matrix4.addCol(grid2[1]);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
}
}

View File

@@ -1852,19 +1852,19 @@ public class TestLongMatrix{
@Test
public void testLaplaceExpansionHelper(){
LongMatrixPublic matrix = new LongMatrixPublic();
LongMatrix matrix = new LongMatrix();
matrix.addRow(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
});
LongMatrixPublic matrix2 = new LongMatrixPublic();
LongMatrix matrix2 = new LongMatrix();
matrix2.setGrid(grid1);
assertThrows(InvalidGeometryException.class, () -> {
matrix2.laplaceExpansionHelper(0, 0);
});
LongMatrixPublic matrix3 = new LongMatrixPublic();
LongMatrix matrix3 = new LongMatrix();
matrix3.setGrid(grid2);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(-1, 0);
@@ -1878,9 +1878,16 @@ public class TestLongMatrix{
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(0, 2);
});
}
private class LongMatrixPublic extends LongMatrix{
LongMatrix matrix4 = new LongMatrix();
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
matrix4.addCol(grid2[1]);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
}
}

View File

@@ -1840,19 +1840,19 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper(){
ModMatrixPublic matrix = new ModMatrixPublic();
ModMatrix matrix = new ModMatrix(Integer.MAX_VALUE);
matrix.addRow(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
});
ModMatrixPublic matrix2 = new ModMatrixPublic();
ModMatrix matrix2 = new ModMatrix(Integer.MAX_VALUE);
matrix2.setGrid(grid1);
assertThrows(InvalidGeometryException.class, () -> {
matrix2.laplaceExpansionHelper(0, 0);
});
ModMatrixPublic matrix3 = new ModMatrixPublic();
ModMatrix matrix3 = new ModMatrix(Integer.MAX_VALUE);
matrix3.setGrid(grid2);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(-1, 0);
@@ -1866,12 +1866,16 @@ public class TestModMatrix{
assertThrows(InvalidCoordinatesException.class, () -> {
matrix3.laplaceExpansionHelper(0, 2);
});
}
private class ModMatrixPublic extends ModMatrix{
public ModMatrixPublic(){
super(Integer.MAX_VALUE);
}
ModMatrix matrix4 = new ModMatrix(Integer.MAX_VALUE);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
matrix4.addCol(grid2[1]);
matrix4.addCol(grid2[0]);
assertThrows(InvalidGeometryException.class, () -> {
matrix4.laplaceExpansionHelper(0, 0);
});
}
}