diff --git a/pom.xml b/pom.xml
index 6fdb665..204fca3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,12 +22,12 @@
scm:git:git://bitbucket.org/Mattrixwv/Matrix.git
scm:git:ssh://bitbucket.org:Mattrixwv/Matrix.git
- https://bitbucket.org/Mattrixwv/Matrix/src
+ https://git.mattrixwv.com/BaseLibraries/Matrix
com.mattrixwv
matrix
- 1.3.1
+ 1.3.2-SNAPSHOT
Matrix
A library for performing Matrix operations
diff --git a/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java b/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java
index 59b447a..fbb4fdc 100644
--- a/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java
+++ b/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/TestBigBigBigIntegerMatrix.java
-//Mattrixwv
-// Created: 02-10-22
-//Modified: 08-11-24
package com.mattrixwv.matrix;
@@ -64,16 +60,12 @@ public class TestBigIntegerMatrix{
@Test
public void testConstructor_fill0Rows(){
- assertThrows(InvalidGeometryException.class, () -> {
- new BigIntegerMatrix(0, 1, BigInteger.ZERO);
- });
+ assertThrows(InvalidGeometryException.class, () -> new BigIntegerMatrix(0, 1, BigInteger.ZERO));
}
@Test
public void testConstructor_fill0Cols(){
- assertThrows(InvalidGeometryException.class, () -> {
- new BigIntegerMatrix(1, 0, BigInteger.ZERO);
- });
+ assertThrows(InvalidGeometryException.class, () -> new BigIntegerMatrix(1, 0, BigInteger.ZERO));
}
@Test
@@ -155,9 +147,7 @@ public class TestBigIntegerMatrix{
{BigInteger.valueOf(-10), BigInteger.valueOf(-11), BigInteger.valueOf(-12)}
};
- assertThrows(InvalidRowSizeException.class, () -> {
- new BigIntegerMatrix(grid);
- });
+ assertThrows(InvalidRowSizeException.class, () -> new BigIntegerMatrix(grid));
}
@Test
@@ -397,9 +387,7 @@ public class TestBigIntegerMatrix{
BigInteger[][] grid = new BigInteger[0][0];
BigIntegerMatrix matrix = new BigIntegerMatrix(grid);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.laplaceExpansionHelper(0, 0);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.laplaceExpansionHelper(0, 0));
}
@Test
@@ -407,9 +395,7 @@ public class TestBigIntegerMatrix{
BigInteger[][] grid = new BigInteger[0][2];
BigIntegerMatrix matrix = new BigIntegerMatrix(grid);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.laplaceExpansionHelper(0, 0);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.laplaceExpansionHelper(0, 0));
}
@Test
@@ -417,9 +403,7 @@ public class TestBigIntegerMatrix{
BigInteger[][] grid = new BigInteger[2][0];
BigIntegerMatrix matrix = new BigIntegerMatrix(grid);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.laplaceExpansionHelper(0, 0);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.laplaceExpansionHelper(0, 0));
}
@Test
@@ -434,36 +418,28 @@ public class TestBigIntegerMatrix{
public void testLaplaceExpansionHelper_size2_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.laplaceExpansionHelper(-1, 0);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.laplaceExpansionHelper(-1, 0));
}
@Test
public void testLaplaceExpansionHelper_size2_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.laplaceExpansionHelper(2, 0);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.laplaceExpansionHelper(2, 0));
}
@Test
public void testLaplaceExpansionHelper_size2_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.laplaceExpansionHelper(0, -1);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.laplaceExpansionHelper(0, -1));
}
@Test
public void testLaplaceExpansionHelper_size2_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.laplaceExpansionHelper(0, 2);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.laplaceExpansionHelper(0, 2));
}
@Test
@@ -508,18 +484,14 @@ public class TestBigIntegerMatrix{
public void testLaplaceExpansionHelper_size2x10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.laplaceExpansionHelper(0, 0);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.laplaceExpansionHelper(0, 0));
}
@Test
public void testLaplaceExpansionHelper_size10x2(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.laplaceExpansionHelper(0, 0);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.laplaceExpansionHelper(0, 0));
}
//! get()
@@ -527,36 +499,28 @@ public class TestBigIntegerMatrix{
public void testGet_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.get(2, 0);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.get(2, 0));
}
@Test
public void testGet_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.get(-1, 0);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.get(-1, 0));
}
@Test
public void testGet_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.get(0, 2);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.get(0, 2));
}
@Test
public void testGet_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.get(0, -1);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.get(0, -1));
}
@Test
@@ -574,18 +538,14 @@ public class TestBigIntegerMatrix{
public void testGetRow_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.getRow(2);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.getRow(2));
}
@Test
public void testGetRow_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.getRow(-1);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.getRow(-1));
}
@Test
@@ -602,27 +562,21 @@ public class TestBigIntegerMatrix{
BigInteger[][] grid = new BigInteger[0][2];
BigIntegerMatrix matrix = new BigIntegerMatrix(grid);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.getCol(0);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.getCol(0));
}
@Test
public void testGetCol_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.getCol(2);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.getCol(2));
}
@Test
public void testGetCol_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.getCol(-1);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.getCol(-1));
}
@Test
@@ -744,36 +698,28 @@ public class TestBigIntegerMatrix{
public void testSet_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.set(-1, 0, BigInteger.ZERO);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.set(-1, 0, BigInteger.ZERO));
}
@Test
public void testSet_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.set(2, 0, BigInteger.ZERO);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.set(2, 0, BigInteger.ZERO));
}
@Test
public void testSet_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.set(0, -1, BigInteger.ZERO);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.set(0, -1, BigInteger.ZERO));
}
@Test
public void testSet_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.set(0, 2, BigInteger.ZERO);
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.set(0, 2, BigInteger.ZERO));
}
@Test
@@ -795,45 +741,35 @@ public class TestBigIntegerMatrix{
public void testSetRow_array_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(-1, new BigInteger[]{BigInteger.ZERO});
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setRow(-1, new BigInteger[]{BigInteger.ZERO}));
}
@Test
public void testSetRow_array_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(2, new BigInteger[]{BigInteger.ZERO});
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setRow(2, new BigInteger[]{BigInteger.ZERO}));
}
@Test
public void testSetRow_array_nullArray(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, (BigInteger[])null);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, (BigInteger[])null));
}
@Test
public void testSetRow_array_arrayLength0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new BigInteger[0]);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, new BigInteger[0]));
}
@Test
public void testSetRow_array_invalidArrayLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO});
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}));
}
@Test
@@ -849,54 +785,42 @@ public class TestBigIntegerMatrix{
public void testSetRow_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.setRow(0, (BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.setRow(0, (BigIntegerMatrix)null));
}
@Test
public void testSetRow_matrix_multipleRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testSetRow_matrix_negativeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(-1, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}));
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setRow(-1, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}})));
}
@Test
public void testSetRow_matrix_largeRow(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(2, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}));
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setRow(2, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}})));
}
@Test
public void testSetRow_matrix_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{}})));
}
@Test
public void testSetRow_matrix_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setRow(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -913,45 +837,35 @@ public class TestBigIntegerMatrix{
public void testSetCol_array_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(-1, new BigInteger[]{BigInteger.ZERO});
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setCol(-1, new BigInteger[]{BigInteger.ZERO}));
}
@Test
public void testSetCol_array_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(2, new BigInteger[]{BigInteger.ZERO});
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setCol(2, new BigInteger[]{BigInteger.ZERO}));
}
@Test
public void testSetCol_array_nullArray(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, (BigInteger[])null);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, (BigInteger[])null));
}
@Test
public void testSetCol_array_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new BigInteger[0]);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, new BigInteger[0]));
}
@Test
public void testSetCol_array_invalidArrayLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO});
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}));
}
@Test
@@ -967,54 +881,42 @@ public class TestBigIntegerMatrix{
public void testSetCol_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.setCol(0, (BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.setCol(0, (BigIntegerMatrix)null));
}
@Test
public void testSetCol_matrix_multipleCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testSetCol_matrix_negativeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(-1, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}));
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setCol(-1, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}})));
}
@Test
public void testSetCol_matrix_largeCol(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(2, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}));
- });
+ assertThrows(InvalidCoordinatesException.class, () -> matrix.setCol(2, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}})));
}
@Test
public void testSetCol_matrix_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{}})));
}
@Test
public void testSetCol_matrix_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.valueOf(0), BigInteger.valueOf(0), BigInteger.valueOf(0)}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.setCol(0, new BigIntegerMatrix(new BigInteger[][]{{BigInteger.valueOf(0), BigInteger.valueOf(0), BigInteger.valueOf(0)}})));
}
@Test
@@ -1031,27 +933,21 @@ public class TestBigIntegerMatrix{
public void testAddRow_array_nullArray(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.addRow((BigInteger[])null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.addRow((BigInteger[])null));
}
@Test
public void testAddRow_array_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new BigInteger[0]);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addRow(new BigInteger[0]));
}
@Test
public void testAddRow_array_invalidArrayLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO});
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addRow(new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}));
}
@Test
@@ -1066,36 +962,28 @@ public class TestBigIntegerMatrix{
public void testAddRow_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.addRow((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.addRow((BigIntegerMatrix)null));
}
@Test
public void testAddRow_matrix_multipleRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addRow(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testAddRow_matrix_noRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new BigIntegerMatrix(new BigInteger[0][0]));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addRow(new BigIntegerMatrix(new BigInteger[0][0])));
}
@Test
public void testAddRow_matrix_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addRow(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1111,27 +999,21 @@ public class TestBigIntegerMatrix{
public void testAddCol_array_nullArray(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.addCol((BigInteger[])null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.addCol((BigInteger[])null));
}
@Test
public void testAddCol_array_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new BigInteger[0]);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addCol(new BigInteger[0]));
}
@Test
public void testAddCol_array_invalidArrayLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO});
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addCol(new BigInteger[]{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}));
}
@Test
@@ -1146,36 +1028,28 @@ public class TestBigIntegerMatrix{
public void testAddCol_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.addCol((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.addCol((BigIntegerMatrix)null));
}
@Test
public void testAddCol_matrix_multipleCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testAddCol_matrix_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{}})));
}
@Test
public void testAddCol_matrix_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1191,27 +1065,21 @@ public class TestBigIntegerMatrix{
public void testAppendRight_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.appendRight((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.appendRight((BigIntegerMatrix)null));
}
@Test
public void testAppendRight_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendRight(new BigIntegerMatrix(new BigInteger[0][0]));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.appendRight(new BigIntegerMatrix(new BigInteger[0][0])));
}
@Test
public void testAppendRight_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendRight(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.appendRight(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1227,27 +1095,21 @@ public class TestBigIntegerMatrix{
public void testAppendBottom_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.appendBottom((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.appendBottom((BigIntegerMatrix)null));
}
@Test
public void testAppendBottom_length0(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendBottom(new BigIntegerMatrix(new BigInteger[0][0]));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.appendBottom(new BigIntegerMatrix(new BigInteger[0][0])));
}
@Test
public void testAppendBottom_invalidLength(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendBottom(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}, {BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.appendBottom(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}, {BigInteger.ZERO}})));
}
@Test
@@ -1263,45 +1125,35 @@ public class TestBigIntegerMatrix{
public void testAdd_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.add((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.add((BigIntegerMatrix)null));
}
@Test
public void testAdd_matrix_fewRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testAdd_matrix_manyRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}})));
}
@Test
public void testAdd_matrix_fewCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}})));
}
@Test
public void testAdd_matrix_manyCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.add(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1357,45 +1209,35 @@ public class TestBigIntegerMatrix{
public void testSubtract_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.subtract((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.subtract((BigIntegerMatrix)null));
}
@Test
public void testSubtract_matrix_fewRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testSubtract_matrix_manyRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testSubtract_matrix_fewCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}})));
}
@Test
public void testSubtract_matrix_manyCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.subtract(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1451,27 +1293,21 @@ public class TestBigIntegerMatrix{
public void testMultiply_matrix_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.multiply((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.multiply((BigIntegerMatrix)null));
}
@Test
public void testMultiply_matrix_manyRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.multiply(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.multiply(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testMultiply_matrix_fewRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.multiply(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.multiply(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1505,18 +1341,14 @@ public class TestBigIntegerMatrix{
public void testPow_rectangle(){
BigIntegerMatrix matrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.valueOf(1), BigInteger.valueOf(2), BigInteger.valueOf(3)}, {BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6)}});
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.pow(2);
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.pow(2));
}
@Test
public void testPow_negative(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.pow(-1);
- });
+ assertThrows(InvalidScalarException.class, () -> matrix.pow(-1));
}
@Test
@@ -1551,27 +1383,21 @@ public class TestBigIntegerMatrix{
public void testDotProduct_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.dotProduct((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.dotProduct((BigIntegerMatrix)null));
}
@Test
public void testDotProduct_fewRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.dotProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.dotProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testDotProduct_manyRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.dotProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.dotProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1608,45 +1434,35 @@ public class TestBigIntegerMatrix{
public void testHadamardProduct_nullMatrix(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(NullMatrixException.class, () -> {
- matrix.hadamardProduct((BigIntegerMatrix)null);
- });
+ assertThrows(NullMatrixException.class, () -> matrix.hadamardProduct((BigIntegerMatrix)null));
}
@Test
public void testHadamardProduct_fewRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testHadamardProduct_manyRows(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
public void testHadamardProduct_fewCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}})));
}
@Test
public void testHadamardProduct_manyCols(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}}));
- });
+ assertThrows(InvalidGeometryException.class, () -> matrix.hadamardProduct(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO}})));
}
@Test
@@ -1773,12 +1589,8 @@ public class TestBigIntegerMatrix{
public void testDeterminant_size0(){
BigIntegerMatrix matrix = new BigIntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
@@ -1817,24 +1629,16 @@ public class TestBigIntegerMatrix{
public void testDeterminant_size2x10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size10x2(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
//! cofactor() / cof()
@@ -1842,12 +1646,8 @@ public class TestBigIntegerMatrix{
public void testCofactor_size0(){
BigIntegerMatrix matrix = new BigIntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
@@ -1892,24 +1692,16 @@ public class TestBigIntegerMatrix{
public void testCofactor_size2x10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size10x2(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
//! adjoint() / adj()
@@ -1917,12 +1709,8 @@ public class TestBigIntegerMatrix{
public void testAdjoint_size0(){
BigIntegerMatrix matrix = new BigIntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
@@ -1967,24 +1755,16 @@ public class TestBigIntegerMatrix{
public void testAdjoint_size2x10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size10x2(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
//! inverse()
@@ -1992,9 +1772,7 @@ public class TestBigIntegerMatrix{
public void testInverse_size0(){
BigIntegerMatrix matrix = new BigIntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
@@ -2017,27 +1795,21 @@ public class TestBigIntegerMatrix{
public void testInverse_size10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidScalarException.class, matrix::inverse);
}
@Test
public void testInverse_size2x10(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size10x2(){
BigIntegerMatrix matrix = new BigIntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
//! equals()
@@ -2197,16 +1969,12 @@ public class TestBigIntegerMatrix{
//! generateIdentity()
@Test
public void testGenerateIdentity_size0(){
- assertThrows(InvalidGeometryException.class, () -> {
- BigIntegerMatrix.generateIdentity(0);
- });
+ assertThrows(InvalidGeometryException.class, () -> BigIntegerMatrix.generateIdentity(0));
}
@Test
public void testGenerateIdentity_negativeSize(){
- assertThrows(InvalidGeometryException.class, () -> {
- BigIntegerMatrix.generateIdentity(-1);
- });
+ assertThrows(InvalidGeometryException.class, () -> BigIntegerMatrix.generateIdentity(-1));
}
@Test
diff --git a/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java b/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
index 6c80d08..07a8b90 100644
--- a/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
+++ b/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java
-//Mattrixwv
-// Created: 02-07-22
-//Modified: 08-10-24
package com.mattrixwv.matrix;
@@ -1773,12 +1769,8 @@ public class TestDoubleMatrix{
public void testDeterminant_size0(){
DoubleMatrix matrix = new DoubleMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
@@ -1817,24 +1809,16 @@ public class TestDoubleMatrix{
public void testDeterminant_size2x10(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size10x2(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
//! cofactor() / cof()
@@ -1842,12 +1826,8 @@ public class TestDoubleMatrix{
public void testCofactor_size0(){
DoubleMatrix matrix = new DoubleMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
@@ -1892,24 +1872,16 @@ public class TestDoubleMatrix{
public void testCofactor_size2x10(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size10x2(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
//! adjoint() / adj()
@@ -1917,12 +1889,8 @@ public class TestDoubleMatrix{
public void testAdjoint_size0(){
DoubleMatrix matrix = new DoubleMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
@@ -1967,24 +1935,16 @@ public class TestDoubleMatrix{
public void testAdjoint_size2x10(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size10x2(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
//! inverse()
@@ -1992,9 +1952,7 @@ public class TestDoubleMatrix{
public void testInverse_size0(){
DoubleMatrix matrix = new DoubleMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
@@ -2017,27 +1975,21 @@ public class TestDoubleMatrix{
public void testInverse_size10(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid10);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidScalarException.class, matrix::inverse);
}
@Test
public void testInverse_size2x10(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size10x2(){
DoubleMatrix matrix = new DoubleMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
//! equals()
diff --git a/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java b/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
index a925adb..9bfedef 100644
--- a/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
+++ b/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
-//Mattrixwv
-// Created: 02-01-22
-//Modified: 08-10-24
package com.mattrixwv.matrix;
@@ -1773,12 +1769,8 @@ public class TestIntegerMatrix{
public void testDeterminant_size0(){
IntegerMatrix matrix = new IntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
@@ -1817,24 +1809,16 @@ public class TestIntegerMatrix{
public void testDeterminant_size2x10(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size10x2(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
//! cofactor() / cof()
@@ -1842,12 +1826,8 @@ public class TestIntegerMatrix{
public void testCofactor_size0(){
IntegerMatrix matrix = new IntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
@@ -1892,24 +1872,16 @@ public class TestIntegerMatrix{
public void testCofactor_size2x10(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size10x2(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
//! adjoint() / adj()
@@ -1917,12 +1889,8 @@ public class TestIntegerMatrix{
public void testAdjoint_size0(){
IntegerMatrix matrix = new IntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
@@ -1967,24 +1935,16 @@ public class TestIntegerMatrix{
public void testAdjoint_size2x10(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size10x2(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
//! inverse()
@@ -1992,9 +1952,7 @@ public class TestIntegerMatrix{
public void testInverse_size0(){
IntegerMatrix matrix = new IntegerMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
@@ -2017,27 +1975,21 @@ public class TestIntegerMatrix{
public void testInverse_size10(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid10);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidScalarException.class, matrix::inverse);
}
@Test
public void testInverse_size2x10(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size10x2(){
IntegerMatrix matrix = new IntegerMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
//! equals()
diff --git a/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java b/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java
index 269b525..cc4513a 100644
--- a/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java
+++ b/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java
-//Mattrixwv
-// Created: 02-10-22
-//Modified: 08-10-24
package com.mattrixwv.matrix;
@@ -1774,12 +1770,8 @@ public class TestLongMatrix{
public void testDeterminant_size0(){
LongMatrix matrix = new LongMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
@@ -1818,24 +1810,16 @@ public class TestLongMatrix{
public void testDeterminant_size2x10(){
LongMatrix matrix = new LongMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size10x2(){
LongMatrix matrix = new LongMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
//! cofactor() / cof()
@@ -1843,12 +1827,8 @@ public class TestLongMatrix{
public void testCofactor_size0(){
LongMatrix matrix = new LongMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
@@ -1893,24 +1873,16 @@ public class TestLongMatrix{
public void testCofactor_size2x10(){
LongMatrix matrix = new LongMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size10x2(){
LongMatrix matrix = new LongMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
//! adjoint() / adj()
@@ -1918,12 +1890,8 @@ public class TestLongMatrix{
public void testAdjoint_size0(){
LongMatrix matrix = new LongMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
@@ -1968,24 +1936,16 @@ public class TestLongMatrix{
public void testAdjoint_size2x10(){
LongMatrix matrix = new LongMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size10x2(){
LongMatrix matrix = new LongMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
//! inverse()
@@ -1993,9 +1953,7 @@ public class TestLongMatrix{
public void testInverse_size0(){
LongMatrix matrix = new LongMatrix();
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
@@ -2018,27 +1976,21 @@ public class TestLongMatrix{
public void testInverse_size10(){
LongMatrix matrix = new LongMatrix(negativeGrid10);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidScalarException.class, matrix::inverse);
}
@Test
public void testInverse_size2x10(){
LongMatrix matrix = new LongMatrix(negativeGrid2x10);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size10x2(){
LongMatrix matrix = new LongMatrix(negativeGrid10x2);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
//! equals()
diff --git a/src/test/java/com/mattrixwv/matrix/TestModMatrix.java b/src/test/java/com/mattrixwv/matrix/TestModMatrix.java
index bbe8d80..3d62c7f 100644
--- a/src/test/java/com/mattrixwv/matrix/TestModMatrix.java
+++ b/src/test/java/com/mattrixwv/matrix/TestModMatrix.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattixwv/matrix/TestModMatrix.java
-//Mattrixwv
-// Created: 02-09-22
-//Modified: 08-11-24
package com.mattrixwv.matrix;
@@ -83,13 +79,13 @@ public class TestModMatrix{
{ 9, 8},
{ 7, 6}
};
- private static final int mod = 26;
+ private static final int MOD = 26;
//! Constructor
@Test
public void testConstructor_mod(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertEquals(0, matrix.getNumRows());
assertEquals(0, matrix.getNumCols());
@@ -98,20 +94,20 @@ public class TestModMatrix{
@Test
public void testConstructor_fill0Rows(){
assertThrows(InvalidGeometryException.class, () -> {
- new ModMatrix(0, 1, 0, mod);
+ new ModMatrix(0, 1, 0, MOD);
});
}
@Test
public void testConstructor_fill0Cols(){
assertThrows(InvalidGeometryException.class, () -> {
- new ModMatrix(1, 0, 0, mod);
+ new ModMatrix(1, 0, 0, MOD);
});
}
@Test
public void testConstructor_fillSize2(){
- ModMatrix matrix = new ModMatrix(2, 2, -1, mod);
+ ModMatrix matrix = new ModMatrix(2, 2, -1, MOD);
assertEquals(2, matrix.getNumRows());
assertEquals(2, matrix.getNumCols());
@@ -123,7 +119,7 @@ public class TestModMatrix{
@Test
public void testConstructor_fillSize10(){
- ModMatrix matrix = new ModMatrix(10, 10, -1, mod);
+ ModMatrix matrix = new ModMatrix(10, 10, -1, MOD);
assertEquals(10, matrix.getNumRows());
assertEquals(10, matrix.getNumCols());
@@ -137,7 +133,7 @@ public class TestModMatrix{
@Test
public void testConstructor_arraySize0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumRows());
assertEquals(0, matrix.getNumCols());
@@ -145,7 +141,7 @@ public class TestModMatrix{
@Test
public void testConstructor_arraySize2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(2, matrix.getNumRows());
assertEquals(2, matrix.getNumCols());
@@ -154,7 +150,7 @@ public class TestModMatrix{
@Test
public void testConstructor_arraySize10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(10, matrix.getNumRows());
assertEquals(10, matrix.getNumCols());
@@ -163,7 +159,7 @@ public class TestModMatrix{
@Test
public void testConstructor_arraySize2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertEquals(2, matrix.getNumRows());
assertEquals(10, matrix.getNumCols());
@@ -172,7 +168,7 @@ public class TestModMatrix{
@Test
public void testConstructor_arraySize10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertEquals(10, matrix.getNumRows());
assertEquals(2, matrix.getNumCols());
@@ -189,13 +185,13 @@ public class TestModMatrix{
};
assertThrows(InvalidRowSizeException.class, () -> {
- new ModMatrix(grid, mod);
+ new ModMatrix(grid, MOD);
});
}
@Test
public void testConstructor_matrixSize0(){
- ModMatrix originalMatrix = new ModMatrix(mod);
+ ModMatrix originalMatrix = new ModMatrix(MOD);
ModMatrix matrix = new ModMatrix(originalMatrix);
assertEquals(0, matrix.getNumRows());
@@ -204,7 +200,7 @@ public class TestModMatrix{
@Test
public void testConstructor_matrixSize2(){
- ModMatrix originalMatrix = new ModMatrix(2, 2, -1, mod);
+ ModMatrix originalMatrix = new ModMatrix(2, 2, -1, MOD);
ModMatrix matrix = new ModMatrix(originalMatrix);
assertEquals(2, matrix.getNumRows());
@@ -218,7 +214,7 @@ public class TestModMatrix{
@Test
public void testConstructor_matrixSize10(){
- ModMatrix originalMatrix = new ModMatrix(10, 10, -1, mod);
+ ModMatrix originalMatrix = new ModMatrix(10, 10, -1, MOD);
ModMatrix matrix = new ModMatrix(originalMatrix);
assertEquals(10, matrix.getNumRows());
@@ -232,7 +228,7 @@ public class TestModMatrix{
@Test
public void testConstructor_matrixSize2x10(){
- ModMatrix originalMatrix = new ModMatrix(2, 10, -1, mod);
+ ModMatrix originalMatrix = new ModMatrix(2, 10, -1, MOD);
ModMatrix matrix = new ModMatrix(originalMatrix);
assertEquals(2, matrix.getNumRows());
@@ -246,7 +242,7 @@ public class TestModMatrix{
@Test
public void testConstructor_matrixSize10x2(){
- ModMatrix originalMatrix = new ModMatrix(10, 2, -1, mod);
+ ModMatrix originalMatrix = new ModMatrix(10, 2, -1, MOD);
ModMatrix matrix = new ModMatrix(originalMatrix);
assertEquals(10, matrix.getNumRows());
@@ -262,7 +258,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(grid);
assertEquals(0, matrix.getNumRows());
@@ -272,7 +268,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(grid);
assertEquals(2, matrix.getNumRows());
@@ -281,7 +277,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size2(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(negativeGrid2);
assertEquals(2, matrix.getNumRows());
@@ -291,7 +287,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size10(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(negativeGrid10);
assertEquals(10, matrix.getNumRows());
@@ -301,7 +297,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size2x10(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(negativeGrid2x10);
assertEquals(2, matrix.getNumRows());
@@ -311,7 +307,7 @@ public class TestModMatrix{
@Test
public void testSetGrid_size10x2(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setGrid(negativeGrid10x2);
assertEquals(10, matrix.getNumRows());
@@ -322,7 +318,7 @@ public class TestModMatrix{
@Test
public void testCopyGrid_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertArrayEquals(grid, matrix.copyGrid());
}
@@ -330,7 +326,7 @@ public class TestModMatrix{
@Test
public void testCopyGrid_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertArrayEquals(grid, matrix.copyGrid());
}
@@ -338,42 +334,42 @@ public class TestModMatrix{
@Test
public void testCopyGrid_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertArrayEquals(grid, matrix.copyGrid());
}
@Test
public void testCopyGrid_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(negativeGrid2Mod26, matrix.copyGrid());
}
@Test
public void testCopyGrid_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertArrayEquals(negativeGrid10Mod26, matrix.copyGrid());
}
@Test
public void testCopyGrid_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertArrayEquals(negativeGrid10x2Mod26, matrix.copyGrid());
}
@Test
public void testCopyGrid_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertArrayEquals(negativeGrid2x10Mod26, matrix.copyGrid());
}
@Test
public void testSetGrid(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.setGrid(negativeGrid2);
assertArrayEquals(negativeGrid2Mod26, matrix.grid);
@@ -382,7 +378,7 @@ public class TestModMatrix{
//! setMod()
@Test
public void testSetMod_negative(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertThrows(InvalidScalarException.class, () -> {
matrix.setMod(-1);
@@ -391,7 +387,7 @@ public class TestModMatrix{
@Test
public void testSetMod_0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertThrows(InvalidScalarException.class, () -> {
matrix.setMod(0);
@@ -400,7 +396,7 @@ public class TestModMatrix{
@Test
public void testSetMod(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.setMod(2);
@@ -410,7 +406,7 @@ public class TestModMatrix{
//! modValue()
@Test
public void testModValue_negative(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
int value = matrix.modValue(-1);
@@ -419,7 +415,7 @@ public class TestModMatrix{
@Test
public void testModValue_negativeLarge(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
int value = matrix.modValue(-28);
@@ -428,7 +424,7 @@ public class TestModMatrix{
@Test
public void testModValue_small(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
int value = matrix.modValue(1);
@@ -437,7 +433,7 @@ public class TestModMatrix{
@Test
public void testModValue_large(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
int value = matrix.modValue(28);
@@ -447,7 +443,7 @@ public class TestModMatrix{
//! modValues()
@Test
public void testModValues_null(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.modValues(null);
@@ -458,7 +454,7 @@ public class TestModMatrix{
public void testModValues(){
int[] values = new int[]{1, 2, 27, 28, -1, -2};
int[] expectedValues = new int[]{1, 2, 1, 2, 25, 24};
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
int[] returnedValues = matrix.modValues(values);
@@ -469,7 +465,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size0(){
int[][] expectedGrid = new int[0][0];
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
matrix.modGrid();
assertArrayEquals(expectedGrid, matrix.grid);
@@ -478,7 +474,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size0x2(){
int[][] expectedGrid = new int[0][2];
- ModMatrix matrix = new ModMatrix(new int[0][2], mod);
+ ModMatrix matrix = new ModMatrix(new int[0][2], MOD);
matrix.modGrid();
assertArrayEquals(expectedGrid, matrix.grid);
@@ -487,7 +483,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size2x0(){
int[][] expectedGrid = new int[2][0];
- ModMatrix matrix = new ModMatrix(new int[2][0], mod);
+ ModMatrix matrix = new ModMatrix(new int[2][0], MOD);
matrix.modGrid();
assertArrayEquals(expectedGrid, matrix.grid);
@@ -495,7 +491,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.grid = negativeGrid2;
matrix.modGrid();
@@ -504,7 +500,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
matrix.grid = negativeGrid10;
matrix.modGrid();
@@ -513,7 +509,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
matrix.grid = negativeGrid2x10;
matrix.modGrid();
@@ -522,7 +518,7 @@ public class TestModMatrix{
@Test
public void testModGrid_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
matrix.grid = negativeGrid10x2;
matrix.modGrid();
@@ -532,16 +528,16 @@ public class TestModMatrix{
//! getMod()
@Test
public void testGetMod(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
- assertEquals(mod, matrix.getMod());
+ assertEquals(MOD, matrix.getMod());
}
//! isSquare()
@Test
public void testIsSquare_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertFalse(matrix.isSquare());
}
@@ -549,7 +545,7 @@ public class TestModMatrix{
@Test
public void testIsSquare_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertFalse(matrix.isSquare());
}
@@ -557,35 +553,35 @@ public class TestModMatrix{
@Test
public void testIsSquare_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertFalse(matrix.isSquare());
}
@Test
public void testIsSquare_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertTrue(matrix.isSquare());
}
@Test
public void testIsSquare_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertTrue(matrix.isSquare());
}
@Test
public void testIsSquare_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertFalse(matrix.isSquare());
}
@Test
public void testIsSquare_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertFalse(matrix.isSquare());
}
@@ -594,7 +590,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
@@ -604,7 +600,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
@@ -614,7 +610,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
@@ -623,7 +619,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
IntegerMatrix result = matrix.laplaceExpansionHelper(0, 0);
assertArrayEquals(new int[][]{{22}}, result.copyGrid());
@@ -631,7 +627,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.laplaceExpansionHelper(-1, 0);
@@ -640,7 +636,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.laplaceExpansionHelper(2, 0);
@@ -649,7 +645,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.laplaceExpansionHelper(0, -1);
@@ -658,7 +654,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.laplaceExpansionHelper(0, 2);
@@ -667,7 +663,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size10_loc0x0(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
IntegerMatrix result = matrix.laplaceExpansionHelper(0, 0);
int[][] expectedGrid = new int[][]{
@@ -686,7 +682,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size10_loc4x4(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
IntegerMatrix result = matrix.laplaceExpansionHelper(4, 4);
int[][] expectedGrid = new int[][]{
@@ -705,7 +701,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
@@ -714,7 +710,7 @@ public class TestModMatrix{
@Test
public void testLaplaceExpansionHelper_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.laplaceExpansionHelper(0, 0);
@@ -724,7 +720,7 @@ public class TestModMatrix{
//! get()
@Test
public void testGet_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.get(2, 0);
@@ -733,7 +729,7 @@ public class TestModMatrix{
@Test
public void testGet_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.get(-1, 0);
@@ -742,7 +738,7 @@ public class TestModMatrix{
@Test
public void testGet_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.get(0, 2);
@@ -751,7 +747,7 @@ public class TestModMatrix{
@Test
public void testGet_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.get(0, -1);
@@ -760,7 +756,7 @@ public class TestModMatrix{
@Test
public void testGet(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(25, matrix.get(0, 0));
assertEquals(24, matrix.get(0, 1));
@@ -771,7 +767,7 @@ public class TestModMatrix{
//! getRow()
@Test
public void testGetRow_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.getRow(2);
@@ -780,7 +776,7 @@ public class TestModMatrix{
@Test
public void testGetRow_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.getRow(-1);
@@ -789,7 +785,7 @@ public class TestModMatrix{
@Test
public void testGetRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(new int[][]{{25, 24}}, matrix.getRow(0).copyGrid());
assertArrayEquals(new int[][]{{23, 22}}, matrix.getRow(1).copyGrid());
@@ -799,7 +795,7 @@ public class TestModMatrix{
@Test
public void testGetCol_0Rows(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.getCol(0);
@@ -808,7 +804,7 @@ public class TestModMatrix{
@Test
public void testGetCol_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.getCol(2);
@@ -817,7 +813,7 @@ public class TestModMatrix{
@Test
public void testGetCol_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.getCol(-1);
@@ -826,7 +822,7 @@ public class TestModMatrix{
@Test
public void testGetCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(new int[][]{{25}, {23}}, matrix.getCol(0).copyGrid());
assertArrayEquals(new int[][]{{24}, {22}}, matrix.getCol(1).copyGrid());
@@ -836,7 +832,7 @@ public class TestModMatrix{
@Test
public void testGetNumRows_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumRows());
}
@@ -844,7 +840,7 @@ public class TestModMatrix{
@Test
public void testGetNumRows_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumRows());
}
@@ -852,35 +848,35 @@ public class TestModMatrix{
@Test
public void testGetNumRows_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(2, matrix.getNumRows());
}
@Test
public void testGetNumRows_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(2, matrix.getNumRows());
}
@Test
public void testGetNumRows_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(10, matrix.getNumRows());
}
@Test
public void testGetNumRows_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertEquals(2, matrix.getNumRows());
}
@Test
public void testGetNumRows_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertEquals(10, matrix.getNumRows());
}
@@ -889,7 +885,7 @@ public class TestModMatrix{
@Test
public void testGetNumCols_size0(){
int[][] grid = new int[0][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumCols());
}
@@ -897,7 +893,7 @@ public class TestModMatrix{
@Test
public void testGetNumCols_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumCols());
}
@@ -905,35 +901,35 @@ public class TestModMatrix{
@Test
public void testGetNumCols_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertEquals(0, matrix.getNumCols());
}
@Test
public void testGetNumCols_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(2, matrix.getNumCols());
}
@Test
public void testGetNumCols_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(10, matrix.getNumCols());
}
@Test
public void testGetNumCols_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertEquals(10, matrix.getNumCols());
}
@Test
public void testGetNumCols_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertEquals(2, matrix.getNumCols());
}
@@ -941,7 +937,7 @@ public class TestModMatrix{
//! set()
@Test
public void testSet_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.set(-1, 0, 0);
@@ -950,7 +946,7 @@ public class TestModMatrix{
@Test
public void testSet_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.set(2, 0, 0);
@@ -959,7 +955,7 @@ public class TestModMatrix{
@Test
public void testSet_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.set(0, -1, 0);
@@ -968,7 +964,7 @@ public class TestModMatrix{
@Test
public void testSet_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.set(0, 2, 0);
@@ -977,7 +973,7 @@ public class TestModMatrix{
@Test
public void testSet(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.set(0, 0, -5);
matrix.set(0, 1, -6);
@@ -992,7 +988,7 @@ public class TestModMatrix{
//! setRow()
@Test
public void testSetRow_array_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.setRow(-1, new int[]{0});
@@ -1001,7 +997,7 @@ public class TestModMatrix{
@Test
public void testSetRow_array_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.setRow(2, new int[]{0});
@@ -1010,7 +1006,7 @@ public class TestModMatrix{
@Test
public void testSetRow_array_nullArray(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.setRow(0, (int[])null);
@@ -1019,7 +1015,7 @@ public class TestModMatrix{
@Test
public void testSetRow_array_arrayLength0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.setRow(0, new int[0]);
@@ -1028,7 +1024,7 @@ public class TestModMatrix{
@Test
public void testSetRow_array_invalidArrayLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.setRow(0, new int[]{0, 0, 0});
@@ -1037,7 +1033,7 @@ public class TestModMatrix{
@Test
public void testSetRow_array(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.setRow(0, new int[]{-5, -6});
matrix.setRow(1, new int[]{-7, -8});
@@ -1046,7 +1042,7 @@ public class TestModMatrix{
@Test
public void testSetRow_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.setRow(0, (ModMatrix)null);
@@ -1055,61 +1051,61 @@ public class TestModMatrix{
@Test
public void testSetRow_matrix_multipleRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new ModMatrix(new int[][]{{0, 0}, {0, 0}}, mod));
+ matrix.setRow(0, new ModMatrix(new int[][]{{0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testSetRow_matrix_negativeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(-1, new ModMatrix(new int[][]{{0}}, mod));
+ matrix.setRow(-1, new ModMatrix(new int[][]{{0}}, MOD));
});
}
@Test
public void testSetRow_matrix_largeRow(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setRow(2, new ModMatrix(new int[][]{{0}}, mod));
+ matrix.setRow(2, new ModMatrix(new int[][]{{0}}, MOD));
});
}
@Test
public void testSetRow_matrix_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new ModMatrix(new int[][]{{}}, mod));
+ matrix.setRow(0, new ModMatrix(new int[][]{{}}, MOD));
});
}
@Test
public void testSetRow_matrix_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setRow(0, new ModMatrix(new int[][]{{0, 0, 0}}, mod));
+ matrix.setRow(0, new ModMatrix(new int[][]{{0, 0, 0}}, MOD));
});
}
@Test
public void testSetRow_matrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
- matrix.setRow(0, new ModMatrix(new int[][]{{-5, -6}}, mod));
- matrix.setRow(1, new ModMatrix(new int[][]{{-7, -8}}, mod));
+ matrix.setRow(0, new ModMatrix(new int[][]{{-5, -6}}, MOD));
+ matrix.setRow(1, new ModMatrix(new int[][]{{-7, -8}}, MOD));
assertArrayEquals(new int[][]{{21, 20}, {19, 18}}, matrix.copyGrid());
}
@Test
public void testSetRow_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.setRow(0, new IntegerMatrix(new int[][]{{-5, -6}}));
matrix.setRow(1, new IntegerMatrix(new int[][]{{-7, -8}}));
@@ -1119,7 +1115,7 @@ public class TestModMatrix{
//! setCol()
@Test
public void testSetCol_array_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.setCol(25, new int[]{0});
@@ -1128,7 +1124,7 @@ public class TestModMatrix{
@Test
public void testSetCol_array_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
matrix.setCol(2, new int[]{0});
@@ -1137,7 +1133,7 @@ public class TestModMatrix{
@Test
public void testSetCol_array_nullArray(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.setCol(0, (int[])null);
@@ -1146,7 +1142,7 @@ public class TestModMatrix{
@Test
public void testSetCol_array_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.setCol(0, new int[0]);
@@ -1155,7 +1151,7 @@ public class TestModMatrix{
@Test
public void testSetCol_array_invalidArrayLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.setCol(0, new int[]{0, 0, 0});
@@ -1164,7 +1160,7 @@ public class TestModMatrix{
@Test
public void testSetCol_array(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.setCol(0, new int[]{-5, -7});
matrix.setCol(1, new int[]{-6, -8});
@@ -1173,7 +1169,7 @@ public class TestModMatrix{
@Test
public void testSetCol_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.setCol(0, (ModMatrix)null);
@@ -1182,61 +1178,61 @@ public class TestModMatrix{
@Test
public void testSetCol_matrix_multipleCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.setCol(0, new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testSetCol_matrix_negativeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(-1, new ModMatrix(new int[][]{{0}}, mod));
+ matrix.setCol(-1, new ModMatrix(new int[][]{{0}}, MOD));
});
}
@Test
public void testSetCol_matrix_largeCol(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidCoordinatesException.class, () -> {
- matrix.setCol(2, new ModMatrix(new int[][]{{0}}, mod));
+ matrix.setCol(2, new ModMatrix(new int[][]{{0}}, MOD));
});
}
@Test
public void testSetCol_matrix_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new ModMatrix(new int[][]{{}}, mod));
+ matrix.setCol(0, new ModMatrix(new int[][]{{}}, MOD));
});
}
@Test
public void testSetCol_matrix_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.setCol(0, new ModMatrix(new int[][]{{0, 0, 0}}, mod));
+ matrix.setCol(0, new ModMatrix(new int[][]{{0, 0, 0}}, MOD));
});
}
@Test
public void testSetCol_matrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
- matrix.setCol(0, new ModMatrix(new int[][]{{-5}, {-7}}, mod));
- matrix.setCol(1, new ModMatrix(new int[][]{{-6}, {-8}}, mod));
+ matrix.setCol(0, new ModMatrix(new int[][]{{-5}, {-7}}, MOD));
+ matrix.setCol(1, new ModMatrix(new int[][]{{-6}, {-8}}, MOD));
assertArrayEquals(new int[][]{{21, 20}, {19, 18}}, matrix.copyGrid());
}
@Test
public void testSetCol_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.setCol(0, new IntegerMatrix(new int[][]{{-5}, {-7}}));
matrix.setCol(1, new IntegerMatrix(new int[][]{{-6}, {-8}}));
@@ -1246,7 +1242,7 @@ public class TestModMatrix{
//! addRow()
@Test
public void testAddRow_array_nullArray(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.addRow((int[])null);
@@ -1255,7 +1251,7 @@ public class TestModMatrix{
@Test
public void testAddRow_array_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.addRow(new int[0]);
@@ -1264,7 +1260,7 @@ public class TestModMatrix{
@Test
public void testAddRow_array_invalidArrayLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.addRow(new int[]{0, 0, 0});
@@ -1273,7 +1269,7 @@ public class TestModMatrix{
@Test
public void testAddRow_array(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.addRow(new int[]{-5, -6});
assertArrayEquals(new int[][]{{25, 24}, {23, 22}, {21, 20}}, matrix.copyGrid());
@@ -1281,7 +1277,7 @@ public class TestModMatrix{
@Test
public void testAddRow_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.addRow((ModMatrix)null);
@@ -1290,42 +1286,42 @@ public class TestModMatrix{
@Test
public void testAddRow_matrix_multipleRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new ModMatrix(new int[][]{{0, 0}, {0, 0}}, mod));
+ matrix.addRow(new ModMatrix(new int[][]{{0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testAddRow_matrix_noRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new ModMatrix(new int[0][0], mod));
+ matrix.addRow(new ModMatrix(new int[0][0], MOD));
});
}
@Test
public void testAddRow_matrix_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addRow(new ModMatrix(new int[][]{{0, 0, 0}}, mod));
+ matrix.addRow(new ModMatrix(new int[][]{{0, 0, 0}}, MOD));
});
}
@Test
public void testAddRow_matrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
- matrix.addRow(new ModMatrix(new int[][]{{-5, -6}}, mod));
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
+ matrix.addRow(new ModMatrix(new int[][]{{-5, -6}}, MOD));
assertArrayEquals(new int[][]{{25, 24}, {23, 22}, {21, 20}}, matrix.copyGrid());
}
@Test
public void testAddRow_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.addRow(new IntegerMatrix(new int[][]{{-5, -6}}));
assertArrayEquals(new int[][]{{25, 24}, {23, 22}, {21, 20}}, matrix.copyGrid());
@@ -1334,7 +1330,7 @@ public class TestModMatrix{
//! addCol()
@Test
public void testAddCol_array_nullArray(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.addCol((int[])null);
@@ -1343,7 +1339,7 @@ public class TestModMatrix{
@Test
public void testAddCol_array_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.addCol(new int[0]);
@@ -1352,7 +1348,7 @@ public class TestModMatrix{
@Test
public void testAddCol_array_invalidArrayLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.addCol(new int[]{0, 0, 0});
@@ -1361,7 +1357,7 @@ public class TestModMatrix{
@Test
public void testAddCol_array(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.addCol(new int[]{-5, -6});
assertArrayEquals(new int[][]{{25, 24, 21}, {23, 22, 20}}, matrix.copyGrid());
@@ -1369,7 +1365,7 @@ public class TestModMatrix{
@Test
public void testAddCol_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.addCol((ModMatrix)null);
@@ -1378,42 +1374,42 @@ public class TestModMatrix{
@Test
public void testAddCol_matrix_multipleCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.addCol(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testAddCol_matrix_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new ModMatrix(new int[][]{{}}, mod));
+ matrix.addCol(new ModMatrix(new int[][]{{}}, MOD));
});
}
@Test
public void testAddCol_matrix_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.addCol(new ModMatrix(new int[][]{{0, 0, 0}}, mod));
+ matrix.addCol(new ModMatrix(new int[][]{{0, 0, 0}}, MOD));
});
}
@Test
public void testAddCol_matrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
- matrix.addCol(new ModMatrix(new int[][]{{-5}, {-6}}, mod));
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
+ matrix.addCol(new ModMatrix(new int[][]{{-5}, {-6}}, MOD));
assertArrayEquals(new int[][]{{25, 24, 21}, {23, 22, 20}}, matrix.copyGrid());
}
@Test
public void testAddCol_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix.addCol(new IntegerMatrix(new int[][]{{-5}, {-6}}));
assertArrayEquals(new int[][]{{25, 24, 21}, {23, 22, 20}}, matrix.copyGrid());
@@ -1422,7 +1418,7 @@ public class TestModMatrix{
//! appendRight()
@Test
public void testAppendRight_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.appendRight((ModMatrix)null);
@@ -1431,25 +1427,25 @@ public class TestModMatrix{
@Test
public void testAppendRight_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendRight(new ModMatrix(new int[0][0], mod));
+ matrix.appendRight(new ModMatrix(new int[0][0], MOD));
});
}
@Test
public void testAppendRight_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendRight(new ModMatrix(new int[][]{{0, 0, 0}}, mod));
+ matrix.appendRight(new ModMatrix(new int[][]{{0, 0, 0}}, MOD));
});
}
@Test
public void testAppendRight(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.appendRight(matrix);
assertArrayEquals(new int[][]{{25, 24, 25, 24}, {23, 22, 23, 22}}, matrix.copyGrid());
@@ -1457,7 +1453,7 @@ public class TestModMatrix{
@Test
public void testAppendRight_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.appendRight(new IntegerMatrix(negativeGrid2));
assertArrayEquals(new int[][]{{25, 24, 25, 24}, {23, 22, 23, 22}}, matrix.copyGrid());
@@ -1466,7 +1462,7 @@ public class TestModMatrix{
//! appendBottom()
@Test
public void testAppendBottom_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.appendBottom((ModMatrix)null);
@@ -1475,25 +1471,25 @@ public class TestModMatrix{
@Test
public void testAppendBottom_length0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendBottom(new ModMatrix(new int[0][0], mod));
+ matrix.appendBottom(new ModMatrix(new int[0][0], MOD));
});
}
@Test
public void testAppendBottom_invalidLength(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.appendBottom(new ModMatrix(new int[][]{{0}, {0}, {0}}, mod));
+ matrix.appendBottom(new ModMatrix(new int[][]{{0}, {0}, {0}}, MOD));
});
}
@Test
public void testAppendBottom(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.appendBottom(matrix);
assertArrayEquals(new int[][]{{25, 24}, {23, 22}, {25, 24}, {23, 22}}, matrix.copyGrid());
@@ -1501,7 +1497,7 @@ public class TestModMatrix{
@Test
public void testAppendBottom_integerMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.appendBottom(new IntegerMatrix(negativeGrid2));
assertArrayEquals(new int[][]{{25, 24}, {23, 22}, {25, 24}, {23, 22}}, matrix.copyGrid());
@@ -1510,7 +1506,7 @@ public class TestModMatrix{
//! add()
@Test
public void testAdd_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.add((ModMatrix)null);
@@ -1519,44 +1515,44 @@ public class TestModMatrix{
@Test
public void testAdd_matrix_fewRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.add(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testAdd_matrix_manyRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new ModMatrix(new int[][]{{0}, {0}}, mod));
+ matrix.add(new ModMatrix(new int[][]{{0}, {0}}, MOD));
});
}
@Test
public void testAdd_matrix_fewCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new ModMatrix(new int[][]{{0}}, mod));
+ matrix.add(new ModMatrix(new int[][]{{0}}, MOD));
});
}
@Test
public void testAdd_matrix_manyCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.add(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, mod));
+ matrix.add(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, MOD));
});
}
@Test
public void testAdd_matrix_size2(){
- ModMatrix addMatrix = new ModMatrix(new int[][]{{22, 23}, {24, 25}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix addMatrix = new ModMatrix(new int[][]{{22, 23}, {24, 25}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.add(addMatrix);
assertArrayEquals(new int[][]{{21, 21}, {21, 21}}, matrix.copyGrid());
@@ -1575,8 +1571,8 @@ public class TestModMatrix{
{ -30, -29, -28, -27, -26, -25, -24, -23, -22, -21},
{ -20, -19, -18, -17, -16, -15, -14, -13, -12, -11},
{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}
- }, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ }, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
matrix = matrix.add(addMatrix);
assertArrayEquals(new int[][]{
@@ -1595,7 +1591,7 @@ public class TestModMatrix{
@Test
public void testAdd_scalar(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.add(1);
assertArrayEquals(new int[][]{{0, 25}, {24, 23}}, matrix.copyGrid());
@@ -1604,7 +1600,7 @@ public class TestModMatrix{
@Test
public void testAdd_integerMatrix_size2(){
IntegerMatrix addMatrix = new IntegerMatrix(new int[][]{{22, 23}, {24, 25}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.add(addMatrix);
assertArrayEquals(new int[][]{{21, 21}, {21, 21}}, matrix.copyGrid());
@@ -1624,7 +1620,7 @@ public class TestModMatrix{
{ -20, -19, -18, -17, -16, -15, -14, -13, -12, -11},
{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}
});
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
matrix = matrix.add(addMatrix);
assertArrayEquals(new int[][]{
@@ -1644,7 +1640,7 @@ public class TestModMatrix{
//! subtract()
@Test
public void testSubtract_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.subtract((ModMatrix)null);
@@ -1653,44 +1649,44 @@ public class TestModMatrix{
@Test
public void testSubtract_matrix_fewRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.subtract(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testSubtract_matrix_manyRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, mod));
+ matrix.subtract(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testSubtract_matrix_fewCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new ModMatrix(new int[][]{{0}, {0}}, mod));
+ matrix.subtract(new ModMatrix(new int[][]{{0}, {0}}, MOD));
});
}
@Test
public void testSubtract_matrix_manyCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.subtract(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, mod));
+ matrix.subtract(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, MOD));
});
}
@Test
public void testSubtract_matrix_size2(){
- ModMatrix subMatrix = new ModMatrix(new int[][]{{-4, -3}, {-2, -1}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix subMatrix = new ModMatrix(new int[][]{{-4, -3}, {-2, -1}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.subtract(subMatrix);
assertArrayEquals(new int[][]{{3, 1}, {25, 23}}, matrix.copyGrid());
@@ -1709,8 +1705,8 @@ public class TestModMatrix{
{ -30, -29, -28, -27, -26, -25, -24, -23, -22, -21},
{ -20, -19, -18, -17, -16, -15, -14, -13, -12, -11},
{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}
- }, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ }, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
matrix = matrix.subtract(subMatrix);
assertArrayEquals(new int[][]{
@@ -1729,7 +1725,7 @@ public class TestModMatrix{
@Test
public void testSubtract_scalar(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.subtract(1);
assertArrayEquals(new int[][]{{24, 23}, {22, 21}}, matrix.copyGrid());
@@ -1738,7 +1734,7 @@ public class TestModMatrix{
@Test
public void testSubtract_integerMatrix_size2(){
IntegerMatrix subMatrix = new IntegerMatrix(new int[][]{{-4, -3}, {-2, -1}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.subtract(subMatrix);
assertArrayEquals(new int[][]{{3, 1}, {25, 23}}, matrix.copyGrid());
@@ -1758,7 +1754,7 @@ public class TestModMatrix{
{ -20, -19, -18, -17, -16, -15, -14, -13, -12, -11},
{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}
});
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
matrix = matrix.subtract(subMatrix);
assertArrayEquals(new int[][]{
@@ -1778,7 +1774,7 @@ public class TestModMatrix{
//! multiply()
@Test
public void testMultiply_matrix_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.multiply((ModMatrix)null);
@@ -1787,26 +1783,26 @@ public class TestModMatrix{
@Test
public void testMultiply_matrix_manyRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.multiply(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, mod));
+ matrix.multiply(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testMultiply_matrix_fewRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.multiply(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.multiply(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testMultiply_matrix_square(){
- ModMatrix mulMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix mulMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.multiply(mulMatrix);
assertArrayEquals(new int[][]{{19, 16}, {11, 4}}, matrix.copyGrid());
@@ -1814,8 +1810,8 @@ public class TestModMatrix{
@Test
public void testMultiply_matrix_rectangle(){
- ModMatrix mulMatrix = new ModMatrix(new int[][]{{1, 2, 3}, {4, 5, 6}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix mulMatrix = new ModMatrix(new int[][]{{1, 2, 3}, {4, 5, 6}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.multiply(mulMatrix);
assertArrayEquals(new int[][]{{17, 14, 11}, {7, 0, 19}}, matrix.copyGrid());
@@ -1823,7 +1819,7 @@ public class TestModMatrix{
@Test
public void testMultiply_scalar(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.multiply(2);
assertArrayEquals(new int[][]{{24, 22}, {20, 18}}, matrix.copyGrid());
@@ -1832,7 +1828,7 @@ public class TestModMatrix{
@Test
public void testMultiply_integerMatrix_square(){
IntegerMatrix mulMatrix = new IntegerMatrix(new int[][]{{1, 2}, {3, 4}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.multiply(mulMatrix);
assertArrayEquals(new int[][]{{19, 16}, {11, 4}}, matrix.copyGrid());
@@ -1841,7 +1837,7 @@ public class TestModMatrix{
@Test
public void testMultiply_integerMatrix_rectangle(){
IntegerMatrix mulMatrix = new IntegerMatrix(new int[][]{{1, 2, 3}, {4, 5, 6}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
matrix = matrix.multiply(mulMatrix);
assertArrayEquals(new int[][]{{17, 14, 11}, {7, 0, 19}}, matrix.copyGrid());
@@ -1850,7 +1846,7 @@ public class TestModMatrix{
//! pow
@Test
public void testPow_rectangle(){
- ModMatrix matrix = new ModMatrix(new int[][]{{1, 2, 3}, {4, 5, 6}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{1, 2, 3}, {4, 5, 6}}, MOD);
assertThrows(InvalidGeometryException.class, () -> {
matrix.pow(2);
@@ -1859,7 +1855,7 @@ public class TestModMatrix{
@Test
public void testPow_negative(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidScalarException.class, () -> {
matrix.pow(-1);
@@ -1868,35 +1864,35 @@ public class TestModMatrix{
@Test
public void testPow_0(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix result = matrix.pow(0);
- assertEquals(new ModMatrix(2, 2, 1, mod), result);
+ assertEquals(new ModMatrix(2, 2, 1, MOD), result);
}
@Test
public void testPow_2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix result = matrix.pow(2);
- assertEquals(new ModMatrix(new int[][]{{7, 10}, {15, 22}}, mod), result);
+ assertEquals(new ModMatrix(new int[][]{{7, 10}, {15, 22}}, MOD), result);
}
@Test
public void testPow_3(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix result = matrix.pow(3);
- assertEquals(new ModMatrix(new int[][]{{15, 24}, {23, 12}}, mod), result);
+ assertEquals(new ModMatrix(new int[][]{{15, 24}, {23, 12}}, MOD), result);
}
//! dotProduct()
@Test
public void testDotProduct_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.dotProduct((ModMatrix)null);
@@ -1905,26 +1901,26 @@ public class TestModMatrix{
@Test
public void testDotProduct_fewRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.dotProduct(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.dotProduct(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testDotProduct_manyRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.dotProduct(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, mod));
+ matrix.dotProduct(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testDotProduct_size2(){
- ModMatrix dotMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix dotMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
int result = matrix.dotProduct(dotMatrix);
assertEquals(24, result);
@@ -1943,8 +1939,8 @@ public class TestModMatrix{
{71, 72, 73, 74, 75, 76, 77, 78, 79, 80},
{81, 82, 83, 84, 85, 86, 87, 88, 89, 90},
{91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
- }, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ }, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
int result = matrix.dotProduct(dotMatrix);
assertEquals(10, result);
@@ -1953,7 +1949,7 @@ public class TestModMatrix{
@Test
public void testDotProduct_integerMatrix_size2(){
IntegerMatrix dotMatrix = new IntegerMatrix(new int[][]{{1, 2}, {3, 4}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
int result = matrix.dotProduct(dotMatrix);
assertEquals(24, result);
@@ -1973,7 +1969,7 @@ public class TestModMatrix{
{81, 82, 83, 84, 85, 86, 87, 88, 89, 90},
{91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
});
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
int result = matrix.dotProduct(dotMatrix);
assertEquals(10, result);
@@ -1982,7 +1978,7 @@ public class TestModMatrix{
//! hadamardProduct()
@Test
public void testHadamardProduct_nullMatrix(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(NullMatrixException.class, () -> {
matrix.hadamardProduct((ModMatrix)null);
@@ -1991,44 +1987,44 @@ public class TestModMatrix{
@Test
public void testHadamardProduct_fewRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0}}, mod));
+ matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0}}, MOD));
});
}
@Test
public void testHadamardProduct_manyRows(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, mod));
+ matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0}, {0, 0}, {0, 0}}, MOD));
});
}
@Test
public void testHadamardProduct_fewCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new ModMatrix(new int[][]{{0}, {0}}, mod));
+ matrix.hadamardProduct(new ModMatrix(new int[][]{{0}, {0}}, MOD));
});
}
@Test
public void testHadamardProduct_manyCols(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertThrows(InvalidGeometryException.class, () -> {
- matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, mod));
+ matrix.hadamardProduct(new ModMatrix(new int[][]{{0, 0, 0}, {0, 0, 0}}, MOD));
});
}
@Test
public void testHadamardProduct_size2(){
- ModMatrix hadMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix hadMatrix = new ModMatrix(new int[][]{{1, 2}, {3, 4}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix result = matrix.hadamardProduct(hadMatrix);
assertArrayEquals(new int[][]{{25, 22}, {17, 10}}, result.copyGrid());
@@ -2047,8 +2043,8 @@ public class TestModMatrix{
{71, 72, 73, 74, 75, 76, 77, 78, 79, 80},
{81, 82, 83, 84, 85, 86, 87, 88, 89, 90},
{91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
- }, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ }, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
ModMatrix result = matrix.hadamardProduct(hadMatrix);
assertArrayEquals(new int[][]{
@@ -2068,7 +2064,7 @@ public class TestModMatrix{
@Test
public void testHadamardProduct_integerMatrix_size2(){
IntegerMatrix hadMatrix = new IntegerMatrix(new int[][]{{1, 2}, {3, 4}});
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix result = matrix.hadamardProduct(hadMatrix);
assertArrayEquals(new int[][]{{25, 22}, {17, 10}}, result.copyGrid());
@@ -2088,7 +2084,7 @@ public class TestModMatrix{
{81, 82, 83, 84, 85, 86, 87, 88, 89, 90},
{91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
});
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
ModMatrix result = matrix.hadamardProduct(hadMatrix);
assertArrayEquals(new int[][]{
@@ -2108,17 +2104,17 @@ public class TestModMatrix{
//! transpose()
@Test
public void testTranspose_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
ModMatrix result = matrix.transpose();
- assertEquals(new ModMatrix(mod), result);
+ assertEquals(new ModMatrix(MOD), result);
}
@Test
public void testTranspose_size0x2(){
int[][] grid = new int[0][2];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertArrayEquals(new int[0][0], matrix.transpose().copyGrid());
}
@@ -2126,21 +2122,21 @@ public class TestModMatrix{
@Test
public void testTranspose_size2x0(){
int[][] grid = new int[2][0];
- ModMatrix matrix = new ModMatrix(grid, mod);
+ ModMatrix matrix = new ModMatrix(grid, MOD);
assertArrayEquals(new int[0][0], matrix.transpose().copyGrid());
}
@Test
public void testTranspose_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(new int[][]{{25, 23}, {24, 22}}, matrix.transpose().copyGrid());
}
@Test
public void testTranspose_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertArrayEquals(new int[][]{
{25, 15, 5, 21, 11, 1, 17, 7, 23, 13},
@@ -2158,7 +2154,7 @@ public class TestModMatrix{
@Test
public void testTranspose_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
assertArrayEquals(new int[][]{
{25, 15},
@@ -2176,7 +2172,7 @@ public class TestModMatrix{
@Test
public void testTranspose_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
assertArrayEquals(new int[][]{
{25, 23, 21, 19, 17, 15, 13, 11, 9, 7},
@@ -2187,19 +2183,15 @@ public class TestModMatrix{
//! determinant() / det()
@Test
public void testDeterminant_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size1(){
- ModMatrix matrix = new ModMatrix(new int[][]{{1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{1}}, MOD);
assertEquals(1, matrix.determinant());
assertEquals(1, matrix.det());
@@ -2207,7 +2199,7 @@ public class TestModMatrix{
@Test
public void testDeterminant_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(-2, matrix.determinant());
assertEquals(-2, matrix.det());
@@ -2215,7 +2207,7 @@ public class TestModMatrix{
@Test
public void testDeterminant_size3(){
- ModMatrix matrix = new ModMatrix(new int[][]{{-1, -2, -3}, {-4, -5, -6}, {-7, -8, -9}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{-1, -2, -3}, {-4, -5, -6}, {-7, -8, -9}}, MOD);
assertEquals(0, matrix.determinant());
assertEquals(0, matrix.det());
@@ -2223,7 +2215,7 @@ public class TestModMatrix{
@Test
public void testDeterminant_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(0, matrix.determinant());
assertEquals(0, matrix.det());
@@ -2231,45 +2223,33 @@ public class TestModMatrix{
@Test
public void testDeterminant_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
@Test
public void testDeterminant_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.determinant();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.det();
- });
+ assertThrows(InvalidGeometryException.class, matrix::determinant);
+ assertThrows(InvalidGeometryException.class, matrix::det);
}
//! cofactor() / cof()
@Test
public void testCofactor_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size1(){
int[][] expectedGrid = new int[][]{{1}};
- ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, MOD);
assertArrayEquals(expectedGrid, matrix.cofactor().copyGrid());
assertArrayEquals(expectedGrid, matrix.cof().copyGrid());
@@ -2278,7 +2258,7 @@ public class TestModMatrix{
@Test
public void testCofactor_size2(){
int[][] expectedGrid = new int[][]{{22, 3}, {2, 25}};
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(expectedGrid, matrix.cofactor().copyGrid());
assertArrayEquals(expectedGrid, matrix.cof().copyGrid());
@@ -2298,7 +2278,7 @@ public class TestModMatrix{
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
};
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertArrayEquals(expectedGrid, matrix.cofactor().copyGrid());
assertArrayEquals(expectedGrid, matrix.cof().copyGrid());
@@ -2306,45 +2286,33 @@ public class TestModMatrix{
@Test
public void testCofactor_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
@Test
public void testCofactor_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cofactor();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.cof();
- });
+ assertThrows(InvalidGeometryException.class, matrix::cofactor);
+ assertThrows(InvalidGeometryException.class, matrix::cof);
}
//! adjoint() / adj()
@Test
public void testAdjoint_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size1(){
int[][] expectedGrid = new int[][]{{1}};
- ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, MOD);
assertArrayEquals(expectedGrid, matrix.adjoint().copyGrid());
assertArrayEquals(expectedGrid, matrix.adj().copyGrid());
@@ -2353,7 +2321,7 @@ public class TestModMatrix{
@Test
public void testAdjoint_size2(){
int[][] expectedGrid = new int[][]{{22, 2}, {3, 25}};
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertArrayEquals(expectedGrid, matrix.adjoint().copyGrid());
assertArrayEquals(expectedGrid, matrix.adj().copyGrid());
@@ -2373,7 +2341,7 @@ public class TestModMatrix{
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertArrayEquals(expectedGrid, matrix.adjoint().copyGrid());
assertArrayEquals(expectedGrid, matrix.adj().copyGrid());
@@ -2381,42 +2349,32 @@ public class TestModMatrix{
@Test
public void testAdjoint_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
@Test
public void testAdjoint_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adjoint();
- });
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.adj();
- });
+ assertThrows(InvalidGeometryException.class, matrix::adjoint);
+ assertThrows(InvalidGeometryException.class, matrix::adj);
}
//! inverse()
@Test
public void testInverse_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size1(){
int[][] expectedGrid = new int[][]{{25}};
- ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{-1}}, MOD);
assertArrayEquals(expectedGrid, matrix.inverse().copyGrid());
}
@@ -2424,103 +2382,97 @@ public class TestModMatrix{
@Test
public void testInverse_size2(){
int[][] expectedGrid = new int[][]{{24, 3}, {3, 22}};
- ModMatrix matrix = new ModMatrix(new int[][]{{4, 3}, {3, 2}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{4, 3}, {3, 2}}, MOD);
assertArrayEquals(expectedGrid, matrix.inverse().copyGrid());
}
@Test
public void testInverse_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
- assertThrows(InvalidScalarException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidScalarException.class, matrix::inverse);
}
@Test
public void testInverse_size2x10(){
- ModMatrix matrix = new ModMatrix(negativeGrid2x10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2x10, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
@Test
public void testInverse_size10x2(){
- ModMatrix matrix = new ModMatrix(negativeGrid10x2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10x2, MOD);
- assertThrows(InvalidGeometryException.class, () -> {
- matrix.inverse();
- });
+ assertThrows(InvalidGeometryException.class, matrix::inverse);
}
//! equals()
@Test
public void testEquals_null(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertFalse(matrix.equals(null));
}
@Test
public void testEquals_matrixObject(){
- ModMatrix equalsMatrix = new ModMatrix(negativeGrid2, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix equalsMatrix = new ModMatrix(negativeGrid2, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertTrue(matrix.equals((Object)equalsMatrix));
}
@Test
public void testEquals_array(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertTrue(matrix.equals(negativeGrid2));
}
@Test
public void testEquals_invalidType(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertFalse(matrix.equals(1));
}
@Test
public void testEquals_manyRows(){
- ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2}, {-3, -4}, {-5, -6}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2}, {-3, -4}, {-5, -6}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertFalse(matrix.equals(equalsMatrix));
}
@Test
public void testEquals_fewRows(){
- ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertFalse(matrix.equals(equalsMatrix));
}
@Test
public void testEquals_manyCols(){
- ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2, -3}, {-4, -5, -6}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1, -2, -3}, {-4, -5, -6}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertFalse(matrix.equals(equalsMatrix));
}
@Test
public void testEquals_fewCols(){
- ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1}, {-2}}, mod);
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix equalsMatrix = new ModMatrix(new int[][]{{-1}, {-2}}, MOD);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertFalse(matrix.equals(equalsMatrix));
}
@Test
public void testEquals_notEquals(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
ModMatrix equalsMatrix = matrix.transpose();
assertFalse(matrix.equals(equalsMatrix));
@@ -2528,15 +2480,15 @@ public class TestModMatrix{
@Test
public void testEquals_equals(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
- ModMatrix equalsMatrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
+ ModMatrix equalsMatrix = new ModMatrix(negativeGrid2, MOD);
assertTrue(matrix.equals(equalsMatrix));
}
@Test
public void testEquals_self(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertTrue(matrix.equals(matrix));
}
@@ -2544,28 +2496,28 @@ public class TestModMatrix{
//! hashCode()
@Test
public void testHashCode_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertEquals(Arrays.hashCode(matrix.grid), matrix.hashCode());
}
@Test
public void testHashCode_size1(){
- ModMatrix matrix = new ModMatrix(new int[][]{{1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{1}}, MOD);
assertEquals(Arrays.hashCode(matrix.grid), matrix.hashCode());
}
@Test
public void testHashCode_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals(Arrays.hashCode(matrix.grid), matrix.hashCode());
}
@Test
public void testHashCode_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(Arrays.hashCode(matrix.grid), matrix.hashCode());
}
@@ -2573,28 +2525,28 @@ public class TestModMatrix{
//! toString()
@Test
public void testToString_size0(){
- ModMatrix matrix = new ModMatrix(mod);
+ ModMatrix matrix = new ModMatrix(MOD);
assertEquals("[]\nmod(26)", matrix.toString());
}
@Test
public void testToString_size1(){
- ModMatrix matrix = new ModMatrix(new int[][]{{1}}, mod);
+ ModMatrix matrix = new ModMatrix(new int[][]{{1}}, MOD);
assertEquals("[1]\nmod(26)", matrix.toString());
}
@Test
public void testToString_size2(){
- ModMatrix matrix = new ModMatrix(negativeGrid2, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid2, MOD);
assertEquals("[25, 24]\n[23, 22]\nmod(26)", matrix.toString());
}
@Test
public void testToString_size10(){
- ModMatrix matrix = new ModMatrix(negativeGrid10, mod);
+ ModMatrix matrix = new ModMatrix(negativeGrid10, MOD);
assertEquals(
"[25, 24, 23, 22, 21, 20, 19, 18, 17, 16]\n" +
diff --git a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java
index bdbd137..f7d1e69 100644
--- a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java
+++ b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidCoordinatesException.java
-//Mattrixwv
-// Created: 04-13-23
-//Modified: 08-11-24
package com.mattrixwv.matrix.exceptions;
@@ -11,8 +7,8 @@ import org.junit.jupiter.api.Test;
public class TestInvalidCoordinatesException{
- private static final String message = "message";
- private static final Throwable cause = new Exception();
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Exception();
@Test
@@ -23,22 +19,22 @@ public class TestInvalidCoordinatesException{
}
@Test
public void testConstructor_message(){
- InvalidCoordinatesException exception = new InvalidCoordinatesException(message);
- assertEquals(message, exception.getMessage());
+ InvalidCoordinatesException exception = new InvalidCoordinatesException(MESSAGE);
+ assertEquals(MESSAGE, exception.getMessage());
assertNull(exception.getCause());
}
@Test
public void testConstructor_cause(){
- InvalidCoordinatesException exception = new InvalidCoordinatesException(cause);
- assertEquals(cause.toString(), exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidCoordinatesException exception = new InvalidCoordinatesException(CAUSE);
+ assertEquals(CAUSE.toString(), exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
public void testConstructor_messageCause(){
- InvalidCoordinatesException exception = new InvalidCoordinatesException(message, cause);
- assertEquals(message, exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidCoordinatesException exception = new InvalidCoordinatesException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
diff --git a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java
index 0003a54..af49449 100644
--- a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java
+++ b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidGeometryException.java
-//Mattrixwv
-// Created: 04-13-23
-//Modified: 08-11-24
package com.mattrixwv.matrix.exceptions;
@@ -11,8 +7,8 @@ import org.junit.jupiter.api.Test;
public class TestInvalidGeometryException{
- private static final String message = "message";
- private static final Throwable cause = new Exception();
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Exception();
@Test
@@ -24,22 +20,22 @@ public class TestInvalidGeometryException{
@Test
public void testConstructor_message(){
- InvalidGeometryException exception = new InvalidGeometryException(message);
- assertEquals(message, exception.getMessage());
+ InvalidGeometryException exception = new InvalidGeometryException(MESSAGE);
+ assertEquals(MESSAGE, exception.getMessage());
assertNull(exception.getCause());
}
@Test
public void testConstructor_cause(){
- InvalidGeometryException exception = new InvalidGeometryException(cause);
- assertEquals(cause.toString(), exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidGeometryException exception = new InvalidGeometryException(CAUSE);
+ assertEquals(CAUSE.toString(), exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
public void testConstructor_messageCause(){
- InvalidGeometryException exception = new InvalidGeometryException(message, cause);
- assertEquals(message, exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidGeometryException exception = new InvalidGeometryException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
}
diff --git a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java
index eba4635..97b9054 100644
--- a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java
+++ b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidRowSizeException.java
-//Mattrixwv
-// Created: 04-13-23
-//Modified: 08-11-24
package com.mattrixwv.matrix.exceptions;
@@ -11,8 +7,8 @@ import org.junit.jupiter.api.Test;
public class TestInvalidRowSizeException{
- private static final String message = "message";
- private static final Throwable cause = new Exception();
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Exception();
@Test
@@ -24,22 +20,22 @@ public class TestInvalidRowSizeException{
@Test
public void testConstructor_message(){
- InvalidRowSizeException exception = new InvalidRowSizeException(message);
- assertEquals(message, exception.getMessage());
+ InvalidRowSizeException exception = new InvalidRowSizeException(MESSAGE);
+ assertEquals(MESSAGE, exception.getMessage());
assertNull(exception.getCause());
}
@Test
public void testConstructor_cause(){
- InvalidRowSizeException exception = new InvalidRowSizeException(cause);
- assertEquals(cause.toString(), exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidRowSizeException exception = new InvalidRowSizeException(CAUSE);
+ assertEquals(CAUSE.toString(), exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
public void testConstructor_messageCause(){
- InvalidRowSizeException exception = new InvalidRowSizeException(message, cause);
- assertEquals(message, exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidRowSizeException exception = new InvalidRowSizeException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
}
diff --git a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java
index c014706..089913f 100644
--- a/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java
+++ b/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestInvalidScalarException.java
-//Mattrixwv
-// Created: 04-13-23
-//Modified: 08-11-24
package com.mattrixwv.matrix.exceptions;
@@ -11,8 +7,8 @@ import org.junit.jupiter.api.Test;
public class TestInvalidScalarException{
- private static final String message = "message";
- private static final Throwable cause = new Exception();
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Exception();
@Test
@@ -24,22 +20,22 @@ public class TestInvalidScalarException{
@Test
public void testConstructor_message(){
- InvalidScalarException exception = new InvalidScalarException(message);
- assertEquals(message, exception.getMessage());
+ InvalidScalarException exception = new InvalidScalarException(MESSAGE);
+ assertEquals(MESSAGE, exception.getMessage());
assertNull(exception.getCause());
}
@Test
public void testConstructor_cause(){
- InvalidScalarException exception = new InvalidScalarException(cause);
- assertEquals(cause.toString(), exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidScalarException exception = new InvalidScalarException(CAUSE);
+ assertEquals(CAUSE.toString(), exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
public void testConstructor_messageCause(){
- InvalidScalarException exception = new InvalidScalarException(message, cause);
- assertEquals(message, exception.getMessage());
- assertEquals(cause, exception.getCause());
+ InvalidScalarException exception = new InvalidScalarException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
}
diff --git a/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java b/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java
index 81c4ed8..9c1ed79 100644
--- a/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java
+++ b/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java
@@ -1,7 +1,3 @@
-//Matrix/src/test/java/com/mattrixwv/matrix/exceptions/TestNullMatrixException.java
-//Mattrixwv
-// Created: 04-13-23
-//Modified: 08-11-24
package com.mattrixwv.matrix.exceptions;
@@ -11,8 +7,8 @@ import org.junit.jupiter.api.Test;
public class TestNullMatrixException{
- private static final String message = "message";
- private static final Throwable cause = new Exception();
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Exception();
@Test
@@ -24,21 +20,21 @@ public class TestNullMatrixException{
@Test
public void testConstructor_message(){
- NullMatrixException exception = new NullMatrixException(message);
- assertEquals(message, exception.getMessage());
+ NullMatrixException exception = new NullMatrixException(MESSAGE);
+ assertEquals(MESSAGE, exception.getMessage());
assertNull(exception.getCause());
}
@Test
public void testConstructor_cause(){
- NullMatrixException exception = new NullMatrixException(cause);
- assertEquals(cause.toString(), exception.getMessage());
- assertEquals(cause, exception.getCause());
+ NullMatrixException exception = new NullMatrixException(CAUSE);
+ assertEquals(CAUSE.toString(), exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
@Test
public void testConstructor_messageCause(){
- NullMatrixException exception = new NullMatrixException(message, cause);
- assertEquals(message, exception.getMessage());
- assertEquals(cause, exception.getCause());
+ NullMatrixException exception = new NullMatrixException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, exception.getMessage());
+ assertEquals(CAUSE, exception.getCause());
}
}