From 55debc9821f05998c7d1fd915d3984f960c8dc92 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 9 Jul 2022 02:00:12 -0400 Subject: [PATCH] Updated dependencies --- pom.xml | 37 ++- .../matrix/TestBigIntegerMatrix.java | 298 ++++++++--------- .../mattrixwv/matrix/TestDoubleMatrix.java | 247 +++++++------- .../mattrixwv/matrix/TestIntegerMatrix.java | 300 +++++++++--------- .../com/mattrixwv/matrix/TestLongMatrix.java | 300 +++++++++--------- .../com/mattrixwv/matrix/TestModMatrix.java | 300 +++++++++--------- version-rules.xml | 17 + 7 files changed, 763 insertions(+), 736 deletions(-) create mode 100644 version-rules.xml diff --git a/pom.xml b/pom.xml index 68fd94d..eadc750 100644 --- a/pom.xml +++ b/pom.xml @@ -6,23 +6,23 @@ com.mattrixwv matrix - 1.0 + 1.0.0 Matrix https://www.mattrixwv.com UTF-8 - 11 - 11 - 11 + 18 + 18 + 18 - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter-api + 5.8.2 test @@ -33,7 +33,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M3 + 3.1.0 enforce-maven @@ -43,7 +43,7 @@ - 3.6.3 + 3.8.6 @@ -53,7 +53,7 @@ maven-clean-plugin - 3.1.0 + 3.2.0 @@ -62,7 +62,7 @@ maven-compiler-plugin - 3.8.1 + 3.10.1 ${java.version} @@ -78,7 +78,7 @@ maven-jar-plugin - 3.2.0 + 3.2.2 maven-install-plugin @@ -91,11 +91,20 @@ maven-site-plugin - 3.9.1 + 3.12.0 maven-project-info-reports-plugin - 3.1.1 + 3.3.0 + + + + org.codehaus.mojo + versions-maven-plugin + 2.11.0 + + file://${session.executionRootDirectory}/version-rules.xml + diff --git a/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java b/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java index 3b8b0a7..fc74de4 100644 --- a/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java +++ b/src/test/java/com/mattrixwv/matrix/TestBigIntegerMatrix.java @@ -1,20 +1,20 @@ //Matrix/src/test/java/com/mattrixwv/matrix/TestBigBigIntegerMatrix.java //Mattrixwv // Created: 02-10-22 -//Modified: 06-30-22 +//Modified: 07-09-22 package com.mattrixwv.matrix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigInteger; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.mattrixwv.matrix.exceptions.InvalidCoordinatesException; import com.mattrixwv.matrix.exceptions.InvalidGeometryException; @@ -200,23 +200,23 @@ public class TestBigIntegerMatrix{ public void testEquals(){ //Invalid equals BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); - assertNotEquals(matrix, null); - assertNotEquals(matrix, new int[0]); + assertNotEquals(null, matrix); + assertNotEquals(new int[0], matrix); //1x1 boolean gridEquals = matrix.equals(matrix); - assertTrue("BigIntegerMatrix 1x1 failed equals BigIntegerMatrix.", gridEquals); + assertTrue(gridEquals); @SuppressWarnings("unlikely-arg-type") boolean gridEquals1 = matrix.equals(grid1); - assertTrue("BigIntegerMatrix 1x1 failed equals BigInteger[][].", gridEquals1); + assertTrue(gridEquals1); //2x2 matrix = new BigIntegerMatrix(grid2); boolean gridEquals2 = matrix.equals(matrix); - assertTrue("BigIntegerMatrix 2x2 failed equals BigIntegerMatrix.", gridEquals2); + assertTrue(gridEquals2); @SuppressWarnings("unlikely-arg-type") boolean gridEquals21 = matrix.equals(grid2); - assertTrue("BigIntegerMatrix 2x2 failed equals BigInteger[][].", gridEquals21); + assertTrue(gridEquals21); //false @SuppressWarnings("unlikely-arg-type") boolean gridEquals22 = matrix.equals(transformGrid2_1); @@ -232,33 +232,33 @@ public class TestBigIntegerMatrix{ //3x3 matrix = new BigIntegerMatrix(grid3); boolean gridEquals3 = matrix.equals(matrix); - assertTrue("BigIntegerMatrix 3x3 failed equals BigIntegerMatrix.", gridEquals3); + assertTrue(gridEquals3); @SuppressWarnings("unlikely-arg-type") boolean gridEquals31 = matrix.equals(grid3); - assertTrue("BigIntegerMatrix 3x3 failed equals BigInteger[][].", gridEquals31); + assertTrue(gridEquals31); //4x4 matrix = new BigIntegerMatrix(grid4); boolean gridEquals4 = matrix.equals(matrix); - assertTrue("BigIntegerMatrix 4x4 failed equals BigIntegerMatrix.", gridEquals4); + assertTrue(gridEquals4); @SuppressWarnings("unlikely-arg-type") boolean gridEquals41 = matrix.equals(grid4); - assertTrue("BigIntegerMatrix 4x4 failed equals BigInteger[][].", gridEquals41); + assertTrue(gridEquals41); //10x10 matrix = new BigIntegerMatrix(grid10); boolean gridEquals10 = matrix.equals(matrix); - assertTrue("BigIntegerMatrix = 10x10 failed equals BigIntegerMatrix.", gridEquals10); + assertTrue(gridEquals10); @SuppressWarnings("unlikely-arg-type") boolean gridEquals101 = matrix.equals(grid10); - assertTrue("BigIntegerMatrix 10x10 failed equals BigInteger[][].", gridEquals101); + assertTrue(gridEquals101); } @Test public void testGet(){ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); - assertEquals("BigIntegerMatrix 1x1 failed get.", BigInteger.ONE, matrix.get(0, 0)); + assertEquals(BigInteger.ONE, matrix.get(0, 0)); //Invalid gets final BigIntegerMatrix testMatrix = new BigIntegerMatrix(matrix); @@ -277,19 +277,19 @@ public class TestBigIntegerMatrix{ //2x2 matrix = new BigIntegerMatrix(grid2); - assertEquals("BigIntegerMatrix 2x2 failed get.", BigInteger.ONE, matrix.get(0, 0)); + assertEquals(BigInteger.ONE, matrix.get(0, 0)); //3x3 matrix = new BigIntegerMatrix(grid3); - assertEquals("BigIntegerMatrix 3x3 failed get.", BigInteger.ONE, matrix.get(0, 0)); + assertEquals(BigInteger.ONE, matrix.get(0, 0)); //4x4 matrix = new BigIntegerMatrix(grid4); - assertEquals("BigIntegerMatrix 4x4 failed get.", BigInteger.ONE, matrix.get(0, 0)); + assertEquals(BigInteger.ONE, matrix.get(0, 0)); //10x10 matrix = new BigIntegerMatrix(grid10); - assertEquals("BigIntegerMatrix 10x10 failed get.", BigInteger.ONE, matrix.get(0, 0)); + assertEquals(BigInteger.ONE, matrix.get(0, 0)); } @Test @@ -297,7 +297,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //Invalid gets final BigIntegerMatrix testMatrix = new BigIntegerMatrix(matrix); @@ -311,22 +311,22 @@ public class TestBigIntegerMatrix{ //2x2 matrix = new BigIntegerMatrix(grid2); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.TWO}}); - assertEquals("BigIntegerMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //3x3 matrix = new BigIntegerMatrix(grid3); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}}); - assertEquals("BigIntegerMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //4x4 matrix = new BigIntegerMatrix(grid4); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}}); - assertEquals("BigIntegerMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //10x10 matrix = new BigIntegerMatrix(grid10); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}}); - assertEquals("BigIntegerMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //getNumRows assertEquals(10, matrix.getNumRows()); @@ -337,7 +337,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //Invalid gets final BigIntegerMatrix testMatrix = new BigIntegerMatrix(); @@ -358,7 +358,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE}, {BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -367,7 +367,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE}, {BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -377,7 +377,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE}, {BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -393,7 +393,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE}, {BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 10x10 failed getColumn.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //getNumCols assertEquals(0, testMatrix.getNumCols()); @@ -406,7 +406,7 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); matrix.set(0, 0, BigInteger.TWO); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.TWO}}); - assertEquals("BigIntegerMatrix 1x1 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid sets final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -430,7 +430,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(3), BigInteger.TWO}, {BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //3x3 @@ -441,7 +441,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, }); - assertEquals("BigIntegerMatrix 3x3 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -452,7 +452,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -469,7 +469,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -478,7 +478,7 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); matrix.setRow(0, new BigInteger[]{BigInteger.ZERO}); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}}); - assertEquals("BigIntegerMatrix 1x1 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setRows final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -510,7 +510,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO}, {BigInteger.TWO, BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix BigIntegerMatrix matrix2 = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}); matrix.setRow(1, matrix2); @@ -528,7 +528,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -539,7 +539,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -556,7 +556,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -565,7 +565,7 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); matrix.setCol(0, new BigInteger[]{BigInteger.ONE}); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setCols final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -598,7 +598,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(3), BigInteger.TWO}, {BigInteger.valueOf(3), BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix BigIntegerMatrix vector = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}}); matrix.setCol(1, vector); @@ -616,7 +616,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -627,7 +627,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -644,7 +644,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ZERO, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 10x10 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -659,7 +659,7 @@ public class TestBigIntegerMatrix{ matrix = new BigIntegerMatrix(grid1); matrix.addRow(new BigInteger[]{BigInteger.ONE}); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}, {BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -685,7 +685,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO}, {BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new BigIntegerMatrix(grid2); matrix.addRow(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}})); @@ -705,7 +705,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -717,7 +717,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -735,7 +735,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 10x10 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -750,7 +750,7 @@ public class TestBigIntegerMatrix{ matrix = new BigIntegerMatrix(grid1); matrix.addCol(new BigInteger[]{BigInteger.ONE}); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -775,7 +775,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 2x2 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new BigIntegerMatrix(grid2); matrix.addCol(new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}})); @@ -793,7 +793,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 3x3 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -804,7 +804,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)} }); - assertEquals("BigIntegerMatrix 4x4 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -821,7 +821,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)} }); - assertEquals("BigIntegerMatrix 10x10 failed addColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -830,7 +830,7 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix secondMatrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE, BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Invalid appends final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -849,7 +849,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.ONE, BigInteger.TWO}, {BigInteger.ONE, BigInteger.TWO, BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -859,7 +859,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -870,7 +870,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -887,7 +887,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); } @Test @@ -899,7 +899,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE}, {BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Invalid appends final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -920,7 +920,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO}, {BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -933,7 +933,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -948,7 +948,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -965,13 +965,13 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, }); - assertEquals("BigIntegerMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); } @Test public void testIsSquare(){ BigIntegerMatrix matrix = new BigIntegerMatrix(); - assertFalse("BigIntegerMatrix failed is square", matrix.isSquare()); + assertFalse(matrix.isSquare()); matrix = new BigIntegerMatrix(2, 2, BigInteger.ZERO); assertTrue(matrix.isSquare()); @@ -986,8 +986,8 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix transformMatrix = new BigIntegerMatrix(transformGrid1_1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.TWO}}); - assertEquals("BigIntegerMatrix 1x1 failed add BigIntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); - assertEquals("BigIntegerMatrix 1x1 failed add scalar.", correctMatrix, matrix.add(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(BigInteger.ONE)); //Invalid adds final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -1007,12 +1007,12 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.TWO}, {BigInteger.TWO, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed add BigIntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 2x2 failed add scalar.", correctMatrix, matrix.add(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.add(BigInteger.ONE)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -1022,13 +1022,13 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(3), BigInteger.valueOf(3), BigInteger.valueOf(3)}, {BigInteger.valueOf(3), BigInteger.valueOf(3), BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed add BigIntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 3x3 failed add scalar.", correctMatrix, matrix.add(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.add(BigInteger.ONE)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -1039,14 +1039,14 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4)}, {BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed add BigIntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5)} }); - assertEquals("BigIntegerMatrix 4x4 failed add scalar.", correctMatrix, matrix.add(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.add(BigInteger.ONE)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -1063,7 +1063,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10)}, {BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10)} }); - assertEquals("BigIntegerMatrix 5x5 failed add BigIntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)}, @@ -1076,7 +1076,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.valueOf(11)} }); - assertEquals("BigIntegerMatrix 10x10 failed add BigIntegerMatrix.", correctMatrix, matrix.add(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.add(BigInteger.ONE)); } @Test @@ -1087,8 +1087,8 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ZERO} }); - assertEquals("BigIntegerMatrix 1x1 failed subtract BigIntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); - assertEquals("BigIntegerMatrix 1x1 failed subtract scalar.", correctMatrix, matrix.subtract(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(BigInteger.ONE)); //Invalid subtracts final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -1105,43 +1105,43 @@ public class TestBigIntegerMatrix{ matrix = new BigIntegerMatrix(grid2); transformMatrix = new BigIntegerMatrix(grid2); correctMatrix = new BigIntegerMatrix(2, 2, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 2x2 failed subtract BigIntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ZERO, BigInteger.ONE}, {BigInteger.ZERO, BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed subtract scalar.", correctMatrix, matrix.subtract(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.subtract(BigInteger.ONE)); //3x3 matrix = new BigIntegerMatrix(grid3); transformMatrix = new BigIntegerMatrix(grid3); correctMatrix = new BigIntegerMatrix(3, 3, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 3x3 failed subtract BigIntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 3x3 failed subtract scalar.", correctMatrix, matrix.subtract(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.subtract(BigInteger.ONE)); //4x4 matrix = new BigIntegerMatrix(grid4); transformMatrix = new BigIntegerMatrix(grid4); correctMatrix = new BigIntegerMatrix(4, 4, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 4x4 failed subtract BigIntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 4x4 failed subtract scalar.", correctMatrix, matrix.subtract(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.subtract(BigInteger.ONE)); //10x10 matrix = new BigIntegerMatrix(grid10); transformMatrix = new BigIntegerMatrix(grid10); correctMatrix = new BigIntegerMatrix(10, 10, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 10x10 failed subtract BigIntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9)}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9)}, @@ -1154,7 +1154,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9)}, {BigInteger.ZERO, BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9)} }); - assertEquals("BigIntegerMatrix 10x10 failed subtract scalar.", correctMatrix, matrix.subtract(BigInteger.ONE)); + assertEquals(correctMatrix, matrix.subtract(BigInteger.ONE)); } @Test @@ -1163,8 +1163,8 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix transformMatrix = new BigIntegerMatrix(transformGrid1_2); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(transformGrid1_2); - assertEquals("BigIntegerMatrix 1x1 failed multiplication BigIntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); - assertEquals("BigIntegerMatrix 1x1 failed multiplication scalar.", correctMatrix, matrix.multiply(BigInteger.TWO)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(BigInteger.TWO)); //Invalid multiplication final BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -1180,7 +1180,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(6), BigInteger.valueOf(9)}, {BigInteger.valueOf(6), BigInteger.valueOf(9)} }); - assertEquals("BigIntegerMatrix 2x2 failed multiplication BigIntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); BigIntegerMatrix vector = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO}, {BigInteger.valueOf(3)} @@ -1189,12 +1189,12 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(8)}, {BigInteger.valueOf(8)} }); - assertEquals("BigIntegerMatrix 2x2 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(4)}, {BigInteger.TWO, BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 2x2 failed multiplication scalar.", correctMatrix, matrix.multiply(BigInteger.TWO)); + assertEquals(correctMatrix, matrix.multiply(BigInteger.TWO)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -1204,7 +1204,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(12), BigInteger.valueOf(18), BigInteger.valueOf(24)}, {BigInteger.valueOf(12), BigInteger.valueOf(18), BigInteger.valueOf(24)} }); - assertEquals("BigIntegerMatrix 3x3 failed multiplication BigIntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO}, {BigInteger.valueOf(3)}, @@ -1215,13 +1215,13 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(20)}, {BigInteger.valueOf(20)} }); - assertEquals("BigIntegerMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6)} }); - assertEquals("BigIntegerMatrix 3x3 failed multiplication scalar.", correctMatrix, matrix.multiply(BigInteger.TWO)); + assertEquals(correctMatrix, matrix.multiply(BigInteger.TWO)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -1232,7 +1232,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(20), BigInteger.valueOf(30), BigInteger.valueOf(40), BigInteger.valueOf(50)}, {BigInteger.valueOf(20), BigInteger.valueOf(30), BigInteger.valueOf(40), BigInteger.valueOf(50)}, }); - assertEquals("BigIntegerMatrix 4x4 failed multiplication BigIntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO}, {BigInteger.valueOf(3)}, @@ -1245,14 +1245,14 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(40)}, {BigInteger.valueOf(40)} }); - assertEquals("BigIntegerMatrix 4x4 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8)} }); - assertEquals("BigIntegerMatrix 4x4 failed multiplication scalar.", correctMatrix, matrix.multiply(BigInteger.TWO)); + assertEquals(correctMatrix, matrix.multiply(BigInteger.TWO)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -1269,7 +1269,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(110), BigInteger.valueOf(165), BigInteger.valueOf(220), BigInteger.valueOf(275), BigInteger.valueOf(330), BigInteger.valueOf(385), BigInteger.valueOf(440), BigInteger.valueOf(495), BigInteger.valueOf(550), BigInteger.valueOf(605)}, {BigInteger.valueOf(110), BigInteger.valueOf(165), BigInteger.valueOf(220), BigInteger.valueOf(275), BigInteger.valueOf(330), BigInteger.valueOf(385), BigInteger.valueOf(440), BigInteger.valueOf(495), BigInteger.valueOf(550), BigInteger.valueOf(605)} }); - assertEquals("BigIntegerMatrix 10x10 failed multiplication BigIntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO}, {BigInteger.valueOf(3)}, @@ -1294,7 +1294,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(440)}, {BigInteger.valueOf(440)} }); - assertEquals("BigIntegerMatrix 10x10 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8), BigInteger.valueOf(10), BigInteger.valueOf(12), BigInteger.valueOf(14), BigInteger.valueOf(16), BigInteger.valueOf(18), BigInteger.valueOf(20)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8), BigInteger.valueOf(10), BigInteger.valueOf(12), BigInteger.valueOf(14), BigInteger.valueOf(16), BigInteger.valueOf(18), BigInteger.valueOf(20)}, @@ -1307,7 +1307,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8), BigInteger.valueOf(10), BigInteger.valueOf(12), BigInteger.valueOf(14), BigInteger.valueOf(16), BigInteger.valueOf(18), BigInteger.valueOf(20)}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.valueOf(6), BigInteger.valueOf(8), BigInteger.valueOf(10), BigInteger.valueOf(12), BigInteger.valueOf(14), BigInteger.valueOf(16), BigInteger.valueOf(18), BigInteger.valueOf(20)} }); - assertEquals("BigIntegerMatrix 10x10 failed multiplication scalar.", correctMatrix, matrix.multiply(BigInteger.TWO)); + assertEquals(correctMatrix, matrix.multiply(BigInteger.TWO)); } @Test @@ -1315,7 +1315,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix transformMatrix = new BigIntegerMatrix(transformGrid1_2); - assertEquals("BigIntegerMatrix 1x1 failed dot product BigIntegerMatrix.", BigInteger.TWO, matrix.dotProduct(transformMatrix)); + assertEquals(BigInteger.TWO, matrix.dotProduct(transformMatrix)); //Invalid products BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -1327,22 +1327,22 @@ public class TestBigIntegerMatrix{ //2x2 matrix = new BigIntegerMatrix(grid2); transformMatrix = new BigIntegerMatrix(transformGrid2_2); - assertEquals("BigIntegerMatrix 2x2 failed dot product BigIntegerMatrix.", BigInteger.valueOf(30), matrix.dotProduct(transformMatrix)); + assertEquals(BigInteger.valueOf(30), matrix.dotProduct(transformMatrix)); //3x3 matrix = new BigIntegerMatrix(grid3); transformMatrix = new BigIntegerMatrix(transformGrid3_2); - assertEquals("BigIntegerMatrix 3x3 failed dot product BigIntegerMatrix.", BigInteger.valueOf(162), matrix.dotProduct(transformMatrix)); + assertEquals(BigInteger.valueOf(162), matrix.dotProduct(transformMatrix)); //4x4 matrix = new BigIntegerMatrix(grid4); transformMatrix = new BigIntegerMatrix(transformGrid4_2); - assertEquals("BigIntegerMatrix 4x4 failed dot product BigIntegerMatrix.", BigInteger.valueOf(560), matrix.dotProduct(transformMatrix)); + assertEquals(BigInteger.valueOf(560), matrix.dotProduct(transformMatrix)); //10x10 matrix = new BigIntegerMatrix(grid10); transformMatrix = new BigIntegerMatrix(transformGrid10_2); - assertEquals("BigIntegerMatrix 10x10 failed dot product BigIntegerMatrix.", BigInteger.valueOf(35750), matrix.dotProduct(transformMatrix)); + assertEquals(BigInteger.valueOf(35750), matrix.dotProduct(transformMatrix)); } @Test @@ -1351,7 +1351,7 @@ public class TestBigIntegerMatrix{ BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix transformMatrix = new BigIntegerMatrix(transformGrid1_2); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.TWO}}); - assertEquals("BigIntegerMatrix 1x1 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Invalid hadamard products BigIntegerMatrix testMatrix = new BigIntegerMatrix(grid1); @@ -1371,7 +1371,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(6)}, {BigInteger.TWO, BigInteger.valueOf(6)} }); - assertEquals("BigIntegerMatrix 2x2 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -1381,7 +1381,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12)}, {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12)} }); - assertEquals("BigIntegerMatrix 3x3 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -1392,7 +1392,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12), BigInteger.valueOf(20)}, {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12), BigInteger.valueOf(20)} }); - assertEquals("BigIntegerMatrix 4x4 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -1409,7 +1409,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12), BigInteger.valueOf(20), BigInteger.valueOf(30), BigInteger.valueOf(42), BigInteger.valueOf(56), BigInteger.valueOf(72), BigInteger.valueOf(90), BigInteger.valueOf(110)}, {BigInteger.TWO, BigInteger.valueOf(6), BigInteger.valueOf(12), BigInteger.valueOf(20), BigInteger.valueOf(30), BigInteger.valueOf(42), BigInteger.valueOf(56), BigInteger.valueOf(72), BigInteger.valueOf(90), BigInteger.valueOf(110)} }); - assertEquals("BigIntegerMatrix 10x10 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); } @Test @@ -1417,7 +1417,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //2x2 matrix = new BigIntegerMatrix(grid2); @@ -1425,7 +1425,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.ONE}, {BigInteger.TWO, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -1434,7 +1434,7 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.TWO, BigInteger.TWO}, {BigInteger.valueOf(3), BigInteger.valueOf(3), BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //4x4 matrix = new BigIntegerMatrix(grid4); @@ -1444,7 +1444,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(3), BigInteger.valueOf(3), BigInteger.valueOf(3), BigInteger.valueOf(3)}, {BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -1460,14 +1460,14 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9), BigInteger.valueOf(9)}, {BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10), BigInteger.valueOf(10)}, }); - assertEquals("BigIntegerMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); } @Test public void testDeterminant(){ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); - assertEquals("BigIntegerMatrix 1x1 failed determinant.", BigInteger.ONE, matrix.determinant()); + assertEquals(BigInteger.ONE, matrix.determinant()); //Invalid determinants BigIntegerMatrix testMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}); @@ -1477,35 +1477,35 @@ public class TestBigIntegerMatrix{ //2x2 matrix = new BigIntegerMatrix(grid2); - assertEquals("BigIntegerMatrix 2x2 failed determinant1.", BigInteger.ZERO, matrix.determinant()); + assertEquals(BigInteger.ZERO, matrix.determinant()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.valueOf(4)}, {BigInteger.valueOf(4), BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed determinant2.", BigInteger.valueOf(-15), matrix.determinant()); + assertEquals(BigInteger.valueOf(-15), matrix.determinant()); //det assertEquals(matrix.determinant(), matrix.det()); //3x3 matrix = new BigIntegerMatrix(grid3); - assertEquals("BigIntegerMatrix 3x3 failed determinant1.", BigInteger.ZERO, matrix.determinant()); + assertEquals(BigInteger.ZERO, matrix.determinant()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.valueOf(4), BigInteger.TWO}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.ONE}, {BigInteger.valueOf(4), BigInteger.ONE, BigInteger.TWO} }); - assertEquals("BigIntegerMatrix 3x3 failed determinant2.", BigInteger.valueOf(-21), matrix.determinant()); + assertEquals(BigInteger.valueOf(-21), matrix.determinant()); //4x4 matrix = new BigIntegerMatrix(grid4); - assertEquals("BigIntegerMatrix 4x4 failed determiant1.", BigInteger.ZERO, matrix.determinant()); + assertEquals( BigInteger.ZERO, matrix.determinant()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.ONE}, {BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.ONE, BigInteger.TWO}, {BigInteger.valueOf(4), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3)} }); - assertEquals("BigIntegerMatrix 4x4 failed determinant2.", BigInteger.valueOf(160), matrix.determinant()); + assertEquals(BigInteger.valueOf(160), matrix.determinant()); //Column matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, @@ -1525,7 +1525,7 @@ public class TestBigIntegerMatrix{ //10x10 matrix = new BigIntegerMatrix(grid10); - assertEquals("BigIntegerMatrix 10x10 failed determinant1.", BigInteger.ZERO, matrix.determinant()); + assertEquals(BigInteger.ZERO, matrix.determinant()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.ONE}, @@ -1538,7 +1538,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(9), BigInteger.valueOf(10), BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.valueOf(5), BigInteger.valueOf(6), BigInteger.valueOf(7), BigInteger.valueOf(8)}, {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO, BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 10x10 failed determinant2.", BigInteger.valueOf(-10000000), matrix.determinant()); + assertEquals(BigInteger.valueOf(-10000000), matrix.determinant()); } @Test @@ -1546,7 +1546,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(grid1); - assertEquals("BigIntegerMatrix 1x1 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //Invalid cofactor BigIntegerMatrix testMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}); @@ -1560,14 +1560,14 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.ONE.negate()}, {BigInteger.TWO.negate(), BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //cof assertEquals(matrix.cofactor(), matrix.cof()); //3x3 matrix = new BigIntegerMatrix(grid3); correctMatrix = new BigIntegerMatrix(3, 3, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 3x3 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.valueOf(4), BigInteger.TWO}, {BigInteger.TWO, BigInteger.valueOf(4), BigInteger.ONE}, @@ -1578,12 +1578,12 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(-6), BigInteger.valueOf(-6), BigInteger.valueOf(15)}, {BigInteger.valueOf(-4), BigInteger.valueOf(3), BigInteger.valueOf(-4)} }); - assertEquals("BigIntegerMatrix 3x3 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //4x4 matrix = new BigIntegerMatrix(grid4); correctMatrix = new BigIntegerMatrix(4, 4, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 4x4 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4), BigInteger.ONE}, @@ -1596,7 +1596,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(4), BigInteger.valueOf(44), BigInteger.valueOf(-36), BigInteger.valueOf(4)}, {BigInteger.valueOf(44), BigInteger.valueOf(-36), BigInteger.valueOf(4), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //10x10 //?Skipping 10x10 test because test took > 5s by itself @@ -1612,7 +1612,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ONE}}); - assertEquals("BigIntegerMatrix 1x1 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //Invalid powers final BigIntegerMatrix testMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO}, {BigInteger.ZERO}}); @@ -1630,7 +1630,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(9), BigInteger.valueOf(18)}, {BigInteger.valueOf(9), BigInteger.valueOf(18)} }); - assertEquals("BigIntegerMatrix 2x2 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //3x3 matrix = new BigIntegerMatrix(grid3); @@ -1639,7 +1639,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(36), BigInteger.valueOf(72), BigInteger.valueOf(108)}, {BigInteger.valueOf(36), BigInteger.valueOf(72), BigInteger.valueOf(108)} }); - assertEquals("BigIntegerMatrix 3x3 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //4x4 //0 @@ -1650,7 +1650,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE}, {BigInteger.ONE, BigInteger.ONE, BigInteger.ONE, BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 4x4 failed power 0.", correctMatrix, matrix.pow(0)); + assertEquals(correctMatrix, matrix.pow(0)); //1 correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, @@ -1658,7 +1658,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)}, {BigInteger.ONE, BigInteger.TWO, BigInteger.valueOf(3), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed power 1.", correctMatrix, matrix.pow(1)); + assertEquals(correctMatrix, matrix.pow(1)); //3 correctMatrix = new BigIntegerMatrix(new BigInteger[][]{ {BigInteger.valueOf(100), BigInteger.valueOf(200), BigInteger.valueOf(300), BigInteger.valueOf(400)}, @@ -1666,7 +1666,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(100), BigInteger.valueOf(200), BigInteger.valueOf(300), BigInteger.valueOf(400)}, {BigInteger.valueOf(100), BigInteger.valueOf(200), BigInteger.valueOf(300), BigInteger.valueOf(400)} }); - assertEquals("BigIntegerMatrix 4x4 failed power 3.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //10x10 matrix = new BigIntegerMatrix(grid10); @@ -1682,7 +1682,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(3025), BigInteger.valueOf(6050), BigInteger.valueOf(9075), BigInteger.valueOf(12100), BigInteger.valueOf(15125), BigInteger.valueOf(18150), BigInteger.valueOf(21175), BigInteger.valueOf(24200), BigInteger.valueOf(27225), BigInteger.valueOf(30250)}, {BigInteger.valueOf(3025), BigInteger.valueOf(6050), BigInteger.valueOf(9075), BigInteger.valueOf(12100), BigInteger.valueOf(15125), BigInteger.valueOf(18150), BigInteger.valueOf(21175), BigInteger.valueOf(24200), BigInteger.valueOf(27225), BigInteger.valueOf(30250)} }); - assertEquals("BigIntegerMatrix 10x10 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); } @Test @@ -1690,7 +1690,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(grid1); - assertEquals("BigIntegerMatrix 1x1 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //2x2 matrix = new BigIntegerMatrix(grid2); @@ -1698,14 +1698,14 @@ public class TestBigIntegerMatrix{ {BigInteger.TWO, BigInteger.TWO.negate()}, {BigInteger.ONE.negate(), BigInteger.ONE} }); - assertEquals("BigIntegerMatrix 2x2 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //adj assertEquals(matrix.adjoint(), matrix.adj()); //3x3 matrix = new BigIntegerMatrix(grid3); correctMatrix = new BigIntegerMatrix(3, 3, BigInteger.ZERO); - assertEquals("BigIntegerMatrix 3x3 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //4x4 matrix = new BigIntegerMatrix(new BigInteger[][]{ @@ -1720,7 +1720,7 @@ public class TestBigIntegerMatrix{ {BigInteger.valueOf(4), BigInteger.valueOf(44), BigInteger.valueOf(-36), BigInteger.valueOf(4)}, {BigInteger.valueOf(44), BigInteger.valueOf(-36), BigInteger.valueOf(4), BigInteger.valueOf(4)} }); - assertEquals("BigIntegerMatrix 4x4 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //10x10 //?Skipping 10x10 test because test took > 5s by itself @@ -1736,7 +1736,7 @@ public class TestBigIntegerMatrix{ //1x1 BigIntegerMatrix matrix = new BigIntegerMatrix(grid1); BigIntegerMatrix correctMatrix = new BigIntegerMatrix(grid1); - assertEquals("BigIntegerMatrix 1x1 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //Invalid inverse BigIntegerMatrix testMatrix = new BigIntegerMatrix(new BigInteger[][]{{BigInteger.ZERO, BigInteger.ZERO}}); @@ -1761,7 +1761,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO.negate(), BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO.negate()} }); - assertEquals("BigIntegerMatrix 2x2 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //3x3 matrix = new BigIntegerMatrix(new BigInteger[][]{ @@ -1774,7 +1774,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO.negate()}, {BigInteger.ZERO, BigInteger.ZERO.negate(), BigInteger.ZERO} }); - assertEquals("BigIntegerMatrix 3x3 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //4x4 matrix = new BigIntegerMatrix(new BigInteger[][]{ @@ -1789,7 +1789,7 @@ public class TestBigIntegerMatrix{ {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO.negate(), BigInteger.ZERO}, {BigInteger.ZERO, BigInteger.ZERO.negate(), BigInteger.ZERO, BigInteger.ZERO} }); - assertEquals("BigIntegerMatrix 4x4 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //10x10 //?Skipped 10x10 because it would take a long time to compute diff --git a/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java b/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java index ca39b42..fc6cc9a 100644 --- a/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java +++ b/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java @@ -1,19 +1,20 @@ //Matrix/src/test/java/com/mattrixwv/matrix/TestDoubleMatrix.java //Mattrixwv // Created: 02-07-22 -//Modified: 02-09-22 +//Modified: 07-09-22 package com.mattrixwv.matrix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.mattrixwv.matrix.exceptions.InvalidCoordinatesException; import com.mattrixwv.matrix.exceptions.InvalidGeometryException; @@ -199,16 +200,16 @@ public class TestDoubleMatrix{ public void testEquals(){ //Invalid equals DoubleMatrix matrix = new DoubleMatrix(grid1); - assertNotEquals(matrix, null); - assertNotEquals(matrix, new int[0]); + assertNotEquals(null, matrix); + assertNotEquals(new int[0], matrix); //1x1 matrix = new DoubleMatrix(grid1); boolean gridEquals = matrix.equals(matrix); - assertTrue("DoubleMatrix 1x1 failed equals DoubleMatrix.", gridEquals); + assertTrue(gridEquals); @SuppressWarnings("unlikely-arg-type") boolean gridEquals1 = matrix.equals(grid1); - assertTrue("DoubleMatrix 1x1 failed equals double[][].", gridEquals1); + assertTrue(gridEquals1); //With delta boolean gridEquals12 = matrix.equals(matrix, 0.0001); assertTrue(gridEquals12); @@ -216,10 +217,10 @@ public class TestDoubleMatrix{ //2x2 matrix = new DoubleMatrix(grid2); boolean gridEquals2 = matrix.equals(matrix); - assertTrue("DoubleMatrix 2x2 failed equals DoubleMatrix.", gridEquals2); + assertTrue(gridEquals2); @SuppressWarnings("unlikely-arg-type") boolean gridEquals21 = matrix.equals(grid2); - assertTrue("DoubleMatrix 2x2 failed equals double[][].", gridEquals21); + assertTrue(gridEquals21); //false @SuppressWarnings("unlikely-arg-type") boolean gridEquals22 = matrix.equals(transformGrid2_1); @@ -235,33 +236,33 @@ public class TestDoubleMatrix{ //3x3 matrix = new DoubleMatrix(grid3); boolean gridEquals3 = matrix.equals(matrix); - assertTrue("DoubleMatrix 3x3 failed equals DoubleMatrix.", gridEquals3); + assertTrue(gridEquals3); @SuppressWarnings("unlikely-arg-type") boolean gridEquals31 = matrix.equals(grid3); - assertTrue("DoubleMatrix 3x3 failed equals double[][].", gridEquals31); + assertTrue(gridEquals31); //4x4 matrix = new DoubleMatrix(grid4); boolean gridEquals4 = matrix.equals(matrix); - assertTrue("DoubleMatrix 4x4 failed equals DoubleMatrix.", gridEquals4); + assertTrue(gridEquals4); @SuppressWarnings("unlikely-arg-type") boolean gridEquals41 = matrix.equals(grid4); - assertTrue("DoubleMatrix 4x4 failed equals double[][].", gridEquals41); + assertTrue(gridEquals41); //10x10 matrix = new DoubleMatrix(grid10); boolean gridEquals10 = matrix.equals(matrix); - assertTrue("DoubleMatrix 10x10 failed equals DoubleMatrix.", gridEquals10); + assertTrue(gridEquals10); @SuppressWarnings("unlikely-arg-type") boolean gridEquals101 = matrix.equals(grid10); - assertTrue("DoubleMatrix 10x10 failed equals double[][].", gridEquals101); + assertTrue(gridEquals101); } @Test public void testGet(){ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); - assertEquals("DoubleMatrix 1x1 failed get.", 0.5, matrix.get(0, 0), 0.0000001); + assertEquals(0.5, matrix.get(0, 0), 0.0000001); //Invalid gets final DoubleMatrix testMatrix = new DoubleMatrix(matrix); @@ -280,19 +281,19 @@ public class TestDoubleMatrix{ //2x2 matrix = new DoubleMatrix(grid2); - assertEquals("DoubleMatrix 2x2 failed get.", 0.5, matrix.get(0, 0), 0.0000001); + assertEquals(0.5, matrix.get(0, 0), 0.0000001); //3x3 matrix = new DoubleMatrix(grid3); - assertEquals("DoubleMatrix 3x3 failed get.", 0.5, matrix.get(0, 0), 0.0000001); + assertEquals(0.5, matrix.get(0, 0), 0.0000001); //4x4 matrix = new DoubleMatrix(grid4); - assertEquals("DoubleMatrix 4x4 failed get.", 0.5, matrix.get(0, 0), 0.0000001); + assertEquals(0.5, matrix.get(0, 0), 0.0000001); //10x10 matrix = new DoubleMatrix(grid10); - assertEquals("DoubleMatrix 10x10 failed get.", 0.5, matrix.get(0, 0), 0.0000001); + assertEquals(0.5, matrix.get(0, 0), 0.0000001); } @Test @@ -300,7 +301,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.5}}); - assertEquals("DoubleMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //Invalid gets final DoubleMatrix testMatrix = new DoubleMatrix(matrix); @@ -314,22 +315,22 @@ public class TestDoubleMatrix{ //2x2 matrix = new DoubleMatrix(grid2); correctMatrix = new DoubleMatrix(new double[][]{{0.5, 1.5}}); - assertEquals("DoubleMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //3x3 matrix = new DoubleMatrix(grid3); correctMatrix = new DoubleMatrix(new double[][]{{0.5, 1.5, 2.5}}); - assertEquals("DoubleMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //4x4 matrix = new DoubleMatrix(grid4); correctMatrix = new DoubleMatrix(new double[][]{{0.5, 1.5, 2.5, 3.5}}); - assertEquals("DoubleMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //10x10 matrix = new DoubleMatrix(grid10); correctMatrix = new DoubleMatrix(new double[][]{{0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}}); - assertEquals("DoubleMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); } @Test @@ -337,7 +338,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.5}}); - assertEquals("DoubleMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //Invalid gets final DoubleMatrix testMatrix = new DoubleMatrix(); @@ -358,7 +359,7 @@ public class TestDoubleMatrix{ {0.5}, {0.5} }); - assertEquals("DoubleMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //3x3 matrix = new DoubleMatrix(grid3); @@ -367,7 +368,7 @@ public class TestDoubleMatrix{ {0.5}, {0.5} }); - assertEquals("DoubleMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //4x4 matrix = new DoubleMatrix(grid4); @@ -377,7 +378,7 @@ public class TestDoubleMatrix{ {0.5}, {0.5} }); - assertEquals("DoubleMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //10x10 matrix = new DoubleMatrix(grid10); @@ -393,7 +394,7 @@ public class TestDoubleMatrix{ {0.5}, {0.5} }); - assertEquals("DoubleMatrix 10x10 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); } @Test @@ -823,7 +824,7 @@ public class TestDoubleMatrix{ DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix secondMatrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.5, 0.5}}); - assertEquals("DoubleMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Invalid appends final DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -842,7 +843,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 0.5, 1.5}, {0.5, 1.5, 0.5, 1.5} }); - assertEquals("DoubleMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //3x3 matrix = new DoubleMatrix(grid3); @@ -852,7 +853,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5, 0.5, 1.5, 2.5}, {0.5, 1.5, 2.5, 0.5, 1.5, 2.5} }); - assertEquals("DoubleMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //4x4 matrix = new DoubleMatrix(grid4); @@ -863,7 +864,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5, 3.5, 0.5, 1.5, 2.5, 3.5}, {0.5, 1.5, 2.5, 3.5, 0.5, 1.5, 2.5, 3.5} }); - assertEquals("DoubleMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //10x10 matrix = new DoubleMatrix(grid10); @@ -880,7 +881,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}, {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5} }); - assertEquals("DoubleMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); } @Test @@ -892,7 +893,7 @@ public class TestDoubleMatrix{ {0.5}, {0.5} }); - assertEquals("DoubleMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Invalid appends final DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -913,7 +914,7 @@ public class TestDoubleMatrix{ {0.5, 1.5}, {0.5, 1.5} }); - assertEquals("DoubleMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //3x3 matrix = new DoubleMatrix(grid3); @@ -926,7 +927,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5}, {0.5, 1.5, 2.5} }); - assertEquals("DoubleMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //4x4 matrix = new DoubleMatrix(grid4); @@ -941,7 +942,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5, 3.5}, {0.5, 1.5, 2.5, 3.5} }); - assertEquals("DoubleMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //10x10 matrix = new DoubleMatrix(grid10); @@ -958,7 +959,7 @@ public class TestDoubleMatrix{ {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}, {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}, {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}, {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5} }); - assertEquals("DoubleMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); } @Test @@ -979,8 +980,8 @@ public class TestDoubleMatrix{ DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix transformMatrix = new DoubleMatrix(transformGrid1_1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{1.0}}); - assertEquals("DoubleMatrix 1x1 failed add DoubleMatrix.", correctMatrix, matrix.add(transformMatrix)); - assertEquals("DoubleMatrix 1x1 failed add scalar.", correctMatrix, matrix.add(0.5)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(0.5)); //Invalid adds final DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -1000,12 +1001,12 @@ public class TestDoubleMatrix{ {1.0, 1.5}, {1.0, 1.5} }); - assertEquals("DoubleMatrix 1x1 failed add DoubleMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 2.0}, {1.0, 2.0} }); - assertEquals("DoubleMatrix 2x2 failed add scalar.", correctMatrix, matrix.add(0.5)); + assertEquals(correctMatrix, matrix.add(0.5)); //3x3 matrix = new DoubleMatrix(grid3); @@ -1015,13 +1016,13 @@ public class TestDoubleMatrix{ {2.0, 2.0, 2.5}, {2.0, 2.0, 2.5} }); - assertEquals("DoubleMatrix 3x3 failed add DoubleMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 2.0, 3.0}, {1.0, 2.0, 3.0}, {1.0, 2.0, 3.0} }); - assertEquals("DoubleMatrix 3x3 failed add scalar.", correctMatrix, matrix.add(0.5)); + assertEquals(correctMatrix, matrix.add(0.5)); //4x4 matrix = new DoubleMatrix(grid4); @@ -1032,14 +1033,14 @@ public class TestDoubleMatrix{ {3.0, 3.0, 3.0, 3.5}, {3.0, 3.0, 3.0, 3.5} }); - assertEquals("DoubleMatrix 4x4 failed add DoubleMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 2.0, 3.0, 4.0}, {1.0, 2.0, 3.0, 4.0}, {1.0, 2.0, 3.0, 4.0}, {1.0, 2.0, 3.0, 4.0} }); - assertEquals("DoubleMatrix 4x4 failed add scalar.", correctMatrix, matrix.add(0.5)); + assertEquals(correctMatrix, matrix.add(0.5)); //10x10 matrix = new DoubleMatrix(grid10); @@ -1056,7 +1057,7 @@ public class TestDoubleMatrix{ {9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.5}, {9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.5} }); - assertEquals("DoubleMatrix 10x10 failed add DoubleMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, @@ -1069,7 +1070,7 @@ public class TestDoubleMatrix{ {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0} }); - assertEquals("DoubleMatrix 10x10 failed add scalar.", correctMatrix, matrix.add(0.5)); + assertEquals(correctMatrix, matrix.add(0.5)); } @Test @@ -1078,8 +1079,8 @@ public class TestDoubleMatrix{ DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix transformMatrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(1, 1, 0); - assertEquals("DoubleMatrix 1x1 failed subtract DoubleMatrix.", correctMatrix, matrix.subtract(transformMatrix)); - assertEquals("DoubleMatrix 1x1 failed subtract scalar.", correctMatrix, matrix.subtract(0.5)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(0.5)); //Invalid subtracts final DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -1096,43 +1097,43 @@ public class TestDoubleMatrix{ matrix = new DoubleMatrix(grid2); transformMatrix = new DoubleMatrix(grid2); correctMatrix = new DoubleMatrix(2, 2, 0); - assertEquals("DoubleMatrix 2x2 failed subtract DoubleMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {0.0, 1.0}, {0.0, 1.0} }); - assertEquals("DoubleMatrix 2x2 failed subtract scalar.", correctMatrix, matrix.subtract(0.5)); + assertEquals(correctMatrix, matrix.subtract(0.5)); //3x3 matrix = new DoubleMatrix(grid3); transformMatrix = new DoubleMatrix(grid3); correctMatrix = new DoubleMatrix(3, 3, 0); - assertEquals("DoubleMatrix 3x3 failed subtract DoubleMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {0.0, 1.0, 2.0}, {0.0, 1.0, 2.0}, {0.0, 1.0, 2.0} }); - assertEquals("DoubleMatrix 3x3 failed subtract scalar.", correctMatrix, matrix.subtract(0.5)); + assertEquals(correctMatrix, matrix.subtract(0.5)); //4x4 matrix = new DoubleMatrix(grid4); transformMatrix = new DoubleMatrix(grid4); correctMatrix = new DoubleMatrix(4, 4, 0); - assertEquals("DoubleMatrix 4x4 failed subtract DoubleMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {0.0, 1.0, 2.0, 3.0}, {0.0, 1.0, 2.0, 3.0}, {0.0, 1.0, 2.0, 3.0}, {0.0, 1.0, 2.0, 3.0} }); - assertEquals("DoubleMatrix 4x4 failed subtract scalar.", correctMatrix, matrix.subtract(0.5)); + assertEquals(correctMatrix, matrix.subtract(0.5)); //10x10 matrix = new DoubleMatrix(grid10); transformMatrix = new DoubleMatrix(grid10); correctMatrix = new DoubleMatrix(10, 10, 0); - assertEquals("DoubleMatrix 10x10 failed subtract DoubleMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{ {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}, {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}, @@ -1145,7 +1146,7 @@ public class TestDoubleMatrix{ {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}, {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0} }); - assertEquals("DoubleMatrix 10x10 failed subtract scalar.", correctMatrix, matrix.subtract(0.5)); + assertEquals(correctMatrix, matrix.subtract(0.5)); } @Test @@ -1154,9 +1155,9 @@ public class TestDoubleMatrix{ DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix transformMatrix = new DoubleMatrix(transformGrid1_2); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.75}}); - assertEquals("DoubleMatrix 1x1 failed multiplication DoubleMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); correctMatrix = new DoubleMatrix(new double[][]{{1.0}}); - assertEquals("DoubleMatrix 1x1 failed multiplication scalar.", correctMatrix, matrix.multiply(2.0)); + assertEquals(correctMatrix, matrix.multiply(2.0)); //Invalid multiplication final DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -1172,7 +1173,7 @@ public class TestDoubleMatrix{ {3.0, 5.0}, {3.0, 5.0} }); - assertEquals("DoubleMatrix 2x2 failed multiplication DoubleMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); DoubleMatrix vector = new DoubleMatrix(new double[][]{ {1.5}, {2.5} @@ -1181,12 +1182,12 @@ public class TestDoubleMatrix{ {4.5}, {4.5} }); - assertEquals("DoubleMatrix 2x2 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 3.0}, {1.0, 3.0} }); - assertEquals("DoubleMatrix 2x2 failed multiplication scalar.", correctMatrix, matrix.multiply(2.0)); + assertEquals(correctMatrix, matrix.multiply(2.0)); //3x3 matrix = new DoubleMatrix(grid3); @@ -1196,7 +1197,7 @@ public class TestDoubleMatrix{ {6.75, 11.25, 15.75}, {6.75, 11.25, 15.75} }); - assertEquals("DoubleMatrix 3x3 failed multiplication DoubleMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new DoubleMatrix(new double[][]{ {1.5}, {2.5}, @@ -1207,13 +1208,13 @@ public class TestDoubleMatrix{ {13.25}, {13.25} }); - assertEquals("DoubleMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 3.0, 5.0}, {1.0, 3.0, 5.0}, {1.0, 3.0, 5.0} }); - assertEquals("DoubleMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(2.0)); + assertEquals(correctMatrix, matrix.multiply(2.0)); //4x4 matrix = new DoubleMatrix(grid4); @@ -1224,7 +1225,7 @@ public class TestDoubleMatrix{ {20, 12, 4, 0}, {20, 12, 4, 0} }); - assertEquals("DoubleMatrix 4x4 failed multiplication DoubleMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new DoubleMatrix(new double[][]{ {2.5}, {1.5}, @@ -1237,14 +1238,14 @@ public class TestDoubleMatrix{ {4.75}, {4.75} }); - assertEquals("DoubleMatrix 4x4 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 3.0, 5.0, 7.0}, {1.0, 3.0, 5.0, 7.0}, {1.0, 3.0, 5.0, 7.0}, {1.0, 3.0, 5.0, 7.0} }); - assertEquals("DoubleMatrix 4x4 failed multiplication scalar.", correctMatrix, matrix.multiply(2.0)); + assertEquals(correctMatrix, matrix.multiply(2.0)); //10x10 matrix = new DoubleMatrix(grid10); @@ -1261,7 +1262,7 @@ public class TestDoubleMatrix{ {75, 125, 175, 225, 275, 325, 375, 425, 475, 525}, {75, 125, 175, 225, 275, 325, 375, 425, 475, 525} }); - assertEquals("DoubleMatrix 10x10 failed multiplication DoubleMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new DoubleMatrix(new double[][]{ {1.5}, {2.5}, @@ -1286,7 +1287,7 @@ public class TestDoubleMatrix{ {382.5}, {382.5} }); - assertEquals("DoubleMatrix 10x10 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new DoubleMatrix(new double[][]{ {1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0}, {1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0}, @@ -1299,7 +1300,7 @@ public class TestDoubleMatrix{ {1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0}, {1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0} }); - assertEquals("DoubleMatrix 10x10 failed multiplication scalar.", correctMatrix, matrix.multiply(2.0)); + assertEquals(correctMatrix, matrix.multiply(2.0)); } @Test @@ -1307,7 +1308,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix transformMatrix = new DoubleMatrix(transformGrid1_2); - assertEquals("DoubleMatrix 1x1 failed dot product DoubleMatrix.", 0.75, matrix.dotProduct(transformMatrix), 0.0000001); + assertEquals(0.75, matrix.dotProduct(transformMatrix), 0.0000001); //Invalid products DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -1319,22 +1320,22 @@ public class TestDoubleMatrix{ //2x2 matrix = new DoubleMatrix(grid2); transformMatrix = new DoubleMatrix(transformGrid2_2); - assertEquals("DoubleMatrix 2x2 failed dot product DoubleMatrix.", 16, matrix.dotProduct(transformMatrix), 0.0000001); + assertEquals(16, matrix.dotProduct(transformMatrix), 0.0000001); //3x3 matrix = new DoubleMatrix(grid3); transformMatrix = new DoubleMatrix(transformGrid3_2); - assertEquals("DoubleMatrix 3x3 failed dot product DoubleMatrix.", 101.25, matrix.dotProduct(transformMatrix), 0.0000001); + assertEquals(101.25, matrix.dotProduct(transformMatrix), 0.0000001); //4x4 matrix = new DoubleMatrix(grid4); transformMatrix = new DoubleMatrix(transformGrid4_2); - assertEquals("DoubleMatrix 4x4 failed dot product DoubleMatrix.", 144, matrix.dotProduct(transformMatrix), 0.0000001); + assertEquals(144, matrix.dotProduct(transformMatrix), 0.0000001); //10x10 matrix = new DoubleMatrix(grid10); transformMatrix = new DoubleMatrix(transformGrid10_2); - assertEquals("DoubleMatrix 10x10 failed dot product DoubleMatrix.", 30000, matrix.dotProduct(transformMatrix), 0.0000001); + assertEquals(30000, matrix.dotProduct(transformMatrix), 0.0000001); } @Test @@ -1343,7 +1344,7 @@ public class TestDoubleMatrix{ DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix transformMatrix = new DoubleMatrix(transformGrid1_2); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.75}}); - assertEquals("DoubleMatrix 1x1 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Invalid hadamard products DoubleMatrix testMatrix = new DoubleMatrix(grid1); @@ -1363,7 +1364,7 @@ public class TestDoubleMatrix{ {0.75, 3.75}, {0.75, 3.75} }); - assertEquals("DoubleMatrix 2x2 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //3x3 matrix = new DoubleMatrix(grid3); @@ -1373,7 +1374,7 @@ public class TestDoubleMatrix{ {0.75, 3.75, 8.75}, {0.75, 3.75, 8.75} }); - assertEquals("DoubleMatrix 3x3 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //4x4 matrix = new DoubleMatrix(grid4); @@ -1384,7 +1385,7 @@ public class TestDoubleMatrix{ {1.25, 2.25, 1.25, 0}, {1.25, 2.25, 1.25, 0} }); - assertEquals("DoubleMatrix 4x4 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //10x10 matrix = new DoubleMatrix(grid10); @@ -1401,7 +1402,7 @@ public class TestDoubleMatrix{ {0.75, 3.75, 8.75, 15.75, 24.75, 35.75, 48.75, 63.75, 80.75, 99.75}, {0.75, 3.75, 8.75, 15.75, 24.75, 35.75, 48.75, 63.75, 80.75, 99.75} }); - assertEquals("DoubleMatrix 10x10 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); } @Test @@ -1409,7 +1410,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.5}}); - assertEquals("DoubleMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //2x2 matrix = new DoubleMatrix(grid2); @@ -1417,7 +1418,7 @@ public class TestDoubleMatrix{ {0.5, 0.5}, {1.5, 1.5} }); - assertEquals("DoubleMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //3x3 matrix = new DoubleMatrix(grid3); @@ -1426,7 +1427,7 @@ public class TestDoubleMatrix{ {1.5, 1.5, 1.5}, {2.5, 2.5, 2.5} }); - assertEquals("DoubleMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //4x4 matrix = new DoubleMatrix(grid4); @@ -1436,7 +1437,7 @@ public class TestDoubleMatrix{ {2.5, 2.5, 2.5, 2.5}, {3.5, 3.5, 3.5, 3.5} }); - assertEquals("DoubleMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //10x10 matrix = new DoubleMatrix(grid10); @@ -1452,14 +1453,14 @@ public class TestDoubleMatrix{ {8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5}, {9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5} }); - assertEquals("DoubleMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); } @Test public void testDeterminant(){ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); - assertEquals("DoubleMatrix 1x1 failed determinant.", 0.5, matrix.determinant(), 0.0000001); + assertEquals(0.5, matrix.determinant(), 0.0000001); //Invalid determinants DoubleMatrix testMatrix = new DoubleMatrix(new double[][]{{0.0, 0.0}}); @@ -1469,35 +1470,35 @@ public class TestDoubleMatrix{ //2x2 matrix = new DoubleMatrix(grid2); - assertEquals("IntegerMatrix 2x2 failed determinant1.", 0, matrix.determinant(), 0.0000001); + assertEquals(0, matrix.determinant(), 0.0000001); matrix = new DoubleMatrix(new double[][]{ {0.5, 3.5}, {3.5, 0.5} }); - assertEquals("DoubleMatrix 2x2 failed determinant2.", -12.0, matrix.determinant(), 0.0000001); + assertEquals(-12.0, matrix.determinant(), 0.0000001); //det assertEquals(matrix.determinant(), matrix.det(), 0.0000001); //3x3 matrix = new DoubleMatrix(grid3); - assertEquals("IntegerMatrix 3x3 failed determinant1.", 0, matrix.determinant(), 0.0000001); + assertEquals(0, matrix.determinant(), 0.0000001); matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5}, {1.5, 2.5, 0.5}, {2.5, 0.5, 1.5} }); - assertEquals("DoubleMatrix 3x3 failed determinant2.", -13.5, matrix.determinant(), 0.0000001); + assertEquals(-13.5, matrix.determinant(), 0.0000001); //4x4 matrix = new DoubleMatrix(grid4); - assertEquals("DoubleMatrix 4x4 failed determinant1.", 0, matrix.determinant(), 0.0000001); + assertEquals(0, matrix.determinant(), 0.0000001); matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5, 3.5}, {1.5, 2.5, 3.5, 0.5}, {2.5, 3.5, 0.5, 1.5}, {3.5, 0.5, 1.5, 2.5} }); - assertEquals("DoubleMatrix 4x4 failed determinant2.", 128.0, matrix.determinant(), 0.0000001); + assertEquals(128.0, matrix.determinant(), 0.0000001); //Column matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5, 3.5}, @@ -1517,7 +1518,7 @@ public class TestDoubleMatrix{ //10x10 matrix = new DoubleMatrix(grid10); - assertEquals("DoubleMatrix 10x10 failed determinant1.", 0, matrix.determinant(), 0.0000001); + assertEquals(0, matrix.determinant(), 0.0000001); matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5}, {1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 0.5}, @@ -1530,7 +1531,7 @@ public class TestDoubleMatrix{ {8.5, 9.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5}, {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}, }); - assertEquals("DoubleMatrix 10x10 failed determinatn2.", -10000000.0, matrix.determinant(), 0.0000001); + assertEquals(-10000000.0, matrix.determinant(), 0.0000001); } @Test @@ -1538,7 +1539,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{1}}); - assertEquals("DoubleMatrix 1x1 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //Invalid cofactor DoubleMatrix testMatrix = new DoubleMatrix(new double[][]{{0.0, 0.0}}); @@ -1552,14 +1553,14 @@ public class TestDoubleMatrix{ {1.5, -0.5}, {-1.5, 0.5} }); - assertEquals("DoubleMatrix 2x2 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //cof assertEquals(matrix.cofactor(), matrix.cof()); //3x3 matrix = new DoubleMatrix(grid3); correctMatrix = new DoubleMatrix(3, 3, 0); - assertEquals("DoubleMatrix 3x3 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5}, {1.5, 2.5, 0.5}, @@ -1570,12 +1571,12 @@ public class TestDoubleMatrix{ {-1, -5.5, 3.5}, {-5.5, 3.5, -1} }); - assertEquals("DoubleMatrix 3x3 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //4x4 matrix = new DoubleMatrix(grid4); correctMatrix = new DoubleMatrix(4, 4, 0); - assertEquals("DoubleMatrix 4x4 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new DoubleMatrix(new double[][]{ {0.5, 1.5, 2.5, 3.5}, {1.5, 2.5, 3.5, 0.5}, @@ -1588,14 +1589,14 @@ public class TestDoubleMatrix{ {4, 36, -28, 4}, {36, -28, 4, 4} }); - assertEquals("DoubleMatrix 4x4 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new DoubleMatrix(grid10); correctMatrix = new DoubleMatrix(10, 10, 0); - assertEquals("DoubleMatrix 10x10 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); */ } @@ -1604,7 +1605,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{0.125}}); - assertEquals("DoubleMatrix 1x1 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //Invalid powers final DoubleMatrix testMatrix = new DoubleMatrix(new double[][]{{0.0}, {0.0}}); @@ -1622,7 +1623,7 @@ public class TestDoubleMatrix{ {2, 6}, {2, 6} }); - assertEquals("DoubleMatrix 2x2 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //3x3 matrix = new DoubleMatrix(grid3); @@ -1631,7 +1632,7 @@ public class TestDoubleMatrix{ {10.125, 30.375, 50.625}, {10.125, 30.375, 50.625} }); - assertEquals("DoubleMatrix 3x3 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //4x4 //0 @@ -1658,7 +1659,7 @@ public class TestDoubleMatrix{ {32.0, 96.0, 160.0, 224.0}, {32.0, 96.0, 160.0, 224.0} }); - assertEquals("DoubleMatrix 4x4 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //10x10 matrix = new DoubleMatrix(grid10); @@ -1674,7 +1675,7 @@ public class TestDoubleMatrix{ {1250, 3750, 6250, 8750, 11250, 13750, 16250, 18750, 21250, 23750}, {1250, 3750, 6250, 8750, 11250, 13750, 16250, 18750, 21250, 23750} }); - assertEquals("DoubleMatrix 10x10 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); } @Test @@ -1682,7 +1683,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{1.0}}); - assertEquals("DoubleMatrix 1x1 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //2x2 matrix = new DoubleMatrix(grid2); @@ -1690,14 +1691,14 @@ public class TestDoubleMatrix{ {1.5, -1.5}, {-0.5, 0.5} }); - assertEquals("DoubleMatrix 2x2 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //adj assertEquals(matrix.adjoint(), matrix.adj()); //3x3 matrix = new DoubleMatrix(grid3); correctMatrix = new DoubleMatrix(3, 3, 0); - assertEquals("DoubleMatrix 3x3 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //4x4 matrix = new DoubleMatrix(new double[][]{ @@ -1712,14 +1713,14 @@ public class TestDoubleMatrix{ {4, 36, -28, 4}, {36, -28, 4, 4} }); - assertEquals("DoubleMatrix 4x4 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //10x10 //?Skippng 10x10 test because test took > 5s by itself /* matrix = new DoubleMatrix(grid10); correctMatrix = new DoubleMatrix(10, 10, 0); - assertEquals("DoubleMatrix 10x10 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); */ } @@ -1728,7 +1729,7 @@ public class TestDoubleMatrix{ //1x1 DoubleMatrix matrix = new DoubleMatrix(grid1); DoubleMatrix correctMatrix = new DoubleMatrix(new double[][]{{2.0}}); - assertEquals("DoubleMatrix 1x1 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //Invalid inverse DoubleMatrix testMatrix = new DoubleMatrix(new double[][]{{0.0, 0.0}}); @@ -1753,7 +1754,7 @@ public class TestDoubleMatrix{ {-0.25, 0.75}, {0.75, -0.25} }); - assertEquals("DoubleMatrix 2x2 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //3x3 matrix = new DoubleMatrix(new double[][]{ @@ -1766,7 +1767,7 @@ public class TestDoubleMatrix{ {2.0/27.0, 11.0/27.0, -7.0/27.0}, {11.0/27.0, -7.0/27.0, 2.0/27.0} }); - assertEquals("DoubleMatrix 3x3 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //4x4 matrix = new DoubleMatrix(new double[][]{ @@ -1781,7 +1782,7 @@ public class TestDoubleMatrix{ {0.03125, 0.28125, -0.21875, 0.03125}, {0.28125, -0.21875, 0.03125, 0.03125} }); - assertEquals("DoubleMatrix 4x4 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //10x10 //?Skipped 10x10 because it would take a long time to compute diff --git a/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java b/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java index a11b84c..eae382d 100644 --- a/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java +++ b/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java @@ -1,19 +1,19 @@ //Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java //Mattrixwv // Created: 02-01-22 -//Modified: 07-01-22 +//Modified: 07-09-22 package com.mattrixwv.matrix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.mattrixwv.matrix.exceptions.InvalidCoordinatesException; import com.mattrixwv.matrix.exceptions.InvalidGeometryException; @@ -199,24 +199,24 @@ public class TestIntegerMatrix{ public void testEquals(){ //Invalid equals IntegerMatrix matrix = new IntegerMatrix(grid1); - assertNotEquals(matrix, null); - assertNotEquals(matrix, new double[0]); + assertNotEquals(null, matrix); + assertNotEquals(new double[0], matrix); //1x1 matrix = new IntegerMatrix(grid1); boolean gridEquals = matrix.equals(matrix); - assertTrue("IntegerMatrix 1x1 failed equals IntegerMatrix.", gridEquals); + assertTrue(gridEquals); @SuppressWarnings("unlikely-arg-type") boolean gridEquals1 = matrix.equals(grid1); - assertTrue("IntegerMatrix 1x1 failed equals int[][].", gridEquals1); + assertTrue(gridEquals1); //2x2 matrix = new IntegerMatrix(grid2); boolean gridEquals2 = matrix.equals(matrix); - assertTrue("IntegerMatrix 2x2 failed equals IntegerMatrix.", gridEquals2); + assertTrue(gridEquals2); @SuppressWarnings("unlikely-arg-type") boolean gridEquals21 = matrix.equals(grid2); - assertTrue("IntegerMatrix 2x2 failed equals int[][].", gridEquals21); + assertTrue(gridEquals21); //false @SuppressWarnings("unlikely-arg-type") boolean gridEquals22 = matrix.equals(transformGrid2_1); @@ -232,33 +232,33 @@ public class TestIntegerMatrix{ //3x3 matrix = new IntegerMatrix(grid3); boolean gridEquals3 = matrix.equals(matrix); - assertTrue("IntegerMatrix 3x3 failed equals IntegerMatrix.", gridEquals3); + assertTrue(gridEquals3); @SuppressWarnings("unlikely-arg-type") boolean gridEquals31 = matrix.equals(grid3); - assertTrue("IntegerMatrix 3x3 failed equals int[][].", gridEquals31); + assertTrue(gridEquals31); //4x4 matrix = new IntegerMatrix(grid4); boolean gridEquals4 = matrix.equals(matrix); - assertTrue("IntegerMatrix 4x4 failed equals IntegerMatrix.", gridEquals4); + assertTrue(gridEquals4); @SuppressWarnings("unlikely-arg-type") boolean gridEquals41 = matrix.equals(grid4); - assertTrue("IntegerMatrix 4x4 failed equals int[][].", gridEquals41); + assertTrue(gridEquals41); //10x10 matrix = new IntegerMatrix(grid10); boolean gridEquals10 = matrix.equals(matrix); - assertTrue("IntegerMatrix = 10x10 failed equals IntegerMatrix.", gridEquals10); + assertTrue(gridEquals10); @SuppressWarnings("unlikely-arg-type") boolean gridEquals101 = matrix.equals(grid10); - assertTrue("IntegerMatrix 10x10 failed equals int[][].", gridEquals101); + assertTrue(gridEquals101); } @Test public void testGet(){ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); - assertEquals("IntegerMatrix 1x1 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //Invalid gets final IntegerMatrix testMatrix = new IntegerMatrix(matrix); @@ -277,19 +277,19 @@ public class TestIntegerMatrix{ //2x2 matrix = new IntegerMatrix(grid2); - assertEquals("IntegerMatrix 2x2 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //3x3 matrix = new IntegerMatrix(grid3); - assertEquals("IntegerMatrix 3x3 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //4x4 matrix = new IntegerMatrix(grid4); - assertEquals("IntegerMatrix 4x4 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //10x10 matrix = new IntegerMatrix(grid10); - assertEquals("IntegerMatrix 10x10 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); } @Test @@ -297,7 +297,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); - assertEquals("IntegerMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //Invalid gets final IntegerMatrix testMatrix = new IntegerMatrix(matrix); @@ -311,22 +311,22 @@ public class TestIntegerMatrix{ //2x2 matrix = new IntegerMatrix(grid2); correctMatrix = new IntegerMatrix(new int[][]{{1, 2}}); - assertEquals("IntegerMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //3x3 matrix = new IntegerMatrix(grid3); correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3}}); - assertEquals("IntegerMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //4x4 matrix = new IntegerMatrix(grid4); correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3, 4}}); - assertEquals("IntegerMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //10x10 matrix = new IntegerMatrix(grid10); correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}); - assertEquals("IntegerMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); } @Test @@ -334,7 +334,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); - assertEquals("IntegerMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //Invalid gets final IntegerMatrix testMatrix = new IntegerMatrix(); @@ -355,7 +355,7 @@ public class TestIntegerMatrix{ {1}, {1} }); - assertEquals("IntegerMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //3x3 matrix = new IntegerMatrix(grid3); @@ -364,7 +364,7 @@ public class TestIntegerMatrix{ {1}, {1} }); - assertEquals("IntegerMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //4x4 matrix = new IntegerMatrix(grid4); @@ -374,7 +374,7 @@ public class TestIntegerMatrix{ {1}, {1} }); - assertEquals("IntegerMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //10x10 matrix = new IntegerMatrix(grid10); @@ -390,7 +390,7 @@ public class TestIntegerMatrix{ {1}, {1} }); - assertEquals("IntegerMatrix 10x10 failed getColumn.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); } @Test @@ -399,7 +399,7 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); matrix.set(0, 0, 2); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{2}}); - assertEquals("IntegerMatrix 1x1 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid sets final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -423,7 +423,7 @@ public class TestIntegerMatrix{ {3, 2}, {1, 2} }); - assertEquals("IntegerMatrix 2x2 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //3x3 matrix = new IntegerMatrix(grid3); @@ -433,7 +433,7 @@ public class TestIntegerMatrix{ {1, 2, 3}, {1, 2, 3}, }); - assertEquals("IntegerMatrix 3x3 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new IntegerMatrix(grid4); @@ -444,7 +444,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new IntegerMatrix(grid10); @@ -461,7 +461,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("IntegerMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -470,7 +470,7 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); matrix.setRow(0, new int[]{0}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{0}}); - assertEquals("IntegerMatrix 1x1 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setRows final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -502,7 +502,7 @@ public class TestIntegerMatrix{ {1, 2}, {2, 1} }); - assertEquals("IntegerMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix IntegerMatrix matrix2 = new IntegerMatrix(new int[][]{{0, 0}}); matrix.setRow(1, matrix2); @@ -520,7 +520,7 @@ public class TestIntegerMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("IntegerMatrix 3x3 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new IntegerMatrix(grid4); @@ -531,7 +531,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new IntegerMatrix(grid10); @@ -548,7 +548,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("IntegerMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -557,7 +557,7 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); matrix.setCol(0, new int[]{1}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); - assertEquals("IntegerMatrix 1x1 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setCols final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -589,7 +589,7 @@ public class TestIntegerMatrix{ {3, 2}, {3, 2} }); - assertEquals("IntegerMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix IntegerMatrix vector = new IntegerMatrix(new int[][]{{0}, {0}}); matrix.setCol(1, vector); @@ -607,7 +607,7 @@ public class TestIntegerMatrix{ {0, 2, 3}, {0, 2, 3} }); - assertEquals("IntegerMatrix 3x3 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new IntegerMatrix(grid4); @@ -618,7 +618,7 @@ public class TestIntegerMatrix{ {0, 2, 3, 4}, {0, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new IntegerMatrix(grid10); @@ -635,7 +635,7 @@ public class TestIntegerMatrix{ {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("IntegerMatrix 10x10 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -650,7 +650,7 @@ public class TestIntegerMatrix{ matrix = new IntegerMatrix(grid1); matrix.addRow(new int[]{1}); correctMatrix = new IntegerMatrix(new int[][]{{1}, {1}}); - assertEquals("IntegerMatrix 1x1 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -676,7 +676,7 @@ public class TestIntegerMatrix{ {1, 2}, {1, 2} }); - assertEquals("IntegerMatrix 2x2 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new IntegerMatrix(grid2); matrix.addRow(new IntegerMatrix(new int[][]{{0, 0}})); @@ -696,7 +696,7 @@ public class TestIntegerMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("IntegerMatrix 3x3 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new IntegerMatrix(grid4); @@ -708,7 +708,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new IntegerMatrix(grid10); @@ -726,7 +726,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("IntegerMatrix 10x10 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -741,7 +741,7 @@ public class TestIntegerMatrix{ matrix = new IntegerMatrix(grid1); matrix.addCol(new int[]{1}); correctMatrix = new IntegerMatrix(new int[][]{{1, 1}}); - assertEquals("IntegerMatrix 1x1 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -766,7 +766,7 @@ public class TestIntegerMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("IntegerMatrix 2x2 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new IntegerMatrix(grid2); matrix.addCol(new IntegerMatrix(new int[][]{{0}, {0}})); @@ -784,7 +784,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 3x3 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new IntegerMatrix(grid4); @@ -795,7 +795,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5} }); - assertEquals("IntegerMatrix 4x4 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new IntegerMatrix(grid10); @@ -812,7 +812,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }); - assertEquals("IntegerMatrix 10x10 failed addColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -821,7 +821,7 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix secondMatrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1, 1}}); - assertEquals("IntegerMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Invalid appends final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -840,7 +840,7 @@ public class TestIntegerMatrix{ {1, 2, 1, 2}, {1, 2, 1, 2} }); - assertEquals("IntegerMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //3x3 matrix = new IntegerMatrix(grid3); @@ -850,7 +850,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 1, 2, 3}, {1, 2, 3, 1, 2, 3} }); - assertEquals("IntegerMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //4x4 matrix = new IntegerMatrix(grid4); @@ -861,7 +861,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 1, 2, 3, 4}, {1, 2, 3, 4, 1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //10x10 matrix = new IntegerMatrix(grid10); @@ -878,7 +878,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("IntegerMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); } @Test @@ -890,7 +890,7 @@ public class TestIntegerMatrix{ {1}, {1} }); - assertEquals("IntegerMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Invalid appends final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -911,7 +911,7 @@ public class TestIntegerMatrix{ {1, 2}, {1, 2} }); - assertEquals("IntegerMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //3x3 matrix = new IntegerMatrix(grid3); @@ -924,7 +924,7 @@ public class TestIntegerMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("IntegerMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //4x4 matrix = new IntegerMatrix(grid4); @@ -939,7 +939,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //10x10 matrix = new IntegerMatrix(grid10); @@ -956,7 +956,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, }); - assertEquals("IntegerMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); } @Test @@ -977,8 +977,8 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix transformMatrix = new IntegerMatrix(transformGrid1_1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{2}}); - assertEquals("IntegerMatrix 1x1 failed add IntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); - assertEquals("IntegerMatrix 1x1 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(1)); //Invalid adds final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -998,12 +998,12 @@ public class TestIntegerMatrix{ {2, 2}, {2, 2} }); - assertEquals("IntegerMatrix 2x2 failed add IntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 3}, {2, 3} }); - assertEquals("IntegerMatrix 2x2 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //3x3 matrix = new IntegerMatrix(grid3); @@ -1013,13 +1013,13 @@ public class TestIntegerMatrix{ {3, 3, 3}, {3, 3, 3} }); - assertEquals("IntegerMatrix 3x3 failed add IntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 3, 4}, {2, 3, 4}, {2, 3, 4} }); - assertEquals("IntegerMatrix 3x3 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //4x4 matrix = new IntegerMatrix(grid4); @@ -1030,14 +1030,14 @@ public class TestIntegerMatrix{ {4, 4, 4, 4}, {4, 4, 4, 4} }); - assertEquals("IntegerMatrix 4x4 failed add IntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5} }); - assertEquals("IntegerMatrix 4x4 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //10x10 matrix = new IntegerMatrix(grid10); @@ -1054,7 +1054,7 @@ public class TestIntegerMatrix{ {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} }); - assertEquals("IntegerMatrix 5x5 failed add IntegerMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, @@ -1067,7 +1067,7 @@ public class TestIntegerMatrix{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }); - assertEquals("IntegerMatrix 10x10 failed add IntegerMatrix.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); } @Test @@ -1078,8 +1078,8 @@ public class TestIntegerMatrix{ IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{ {0} }); - assertEquals("IntegerMatrix 1x1 failed subtract IntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); - assertEquals("IntegerMatrix 1x1 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(1)); //Invalid subtracts final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -1096,43 +1096,43 @@ public class TestIntegerMatrix{ matrix = new IntegerMatrix(grid2); transformMatrix = new IntegerMatrix(grid2); correctMatrix = new IntegerMatrix(2, 2, 0); - assertEquals("IntegerMatrix 2x2 failed subtract IntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {0, 1}, {0, 1} }); - assertEquals("IntegerMatrix 2x2 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //3x3 matrix = new IntegerMatrix(grid3); transformMatrix = new IntegerMatrix(grid3); correctMatrix = new IntegerMatrix(3, 3, 0); - assertEquals("IntegerMatrix 3x3 failed subtract IntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {0, 1, 2}, {0, 1, 2}, {0, 1, 2} }); - assertEquals("IntegerMatrix 3x3 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //4x4 matrix = new IntegerMatrix(grid4); transformMatrix = new IntegerMatrix(grid4); correctMatrix = new IntegerMatrix(4, 4, 0); - assertEquals("IntegerMatrix 4x4 failed subtract IntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3} }); - assertEquals("IntegerMatrix 4x4 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //10x10 matrix = new IntegerMatrix(grid10); transformMatrix = new IntegerMatrix(grid10); correctMatrix = new IntegerMatrix(10, 10, 0); - assertEquals("IntegerMatrix 10x10 failed subtract IntegerMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new IntegerMatrix(new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, @@ -1145,7 +1145,7 @@ public class TestIntegerMatrix{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} }); - assertEquals("IntegerMatrix 10x10 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); } @Test @@ -1154,8 +1154,8 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix transformMatrix = new IntegerMatrix(transformGrid1_2); IntegerMatrix correctMatrix = new IntegerMatrix(transformGrid1_2); - assertEquals("IntegerMatrix 1x1 failed multiplication IntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); - assertEquals("IntegerMatrix 1x1 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(2)); //Invalid multiplication final IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -1171,7 +1171,7 @@ public class TestIntegerMatrix{ {6, 9}, {6, 9} }); - assertEquals("IntegerMatrix 2x2 failed multiplication IntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); IntegerMatrix vector = new IntegerMatrix(new int[][]{ {2}, {3} @@ -1180,12 +1180,12 @@ public class TestIntegerMatrix{ {8}, {8} }); - assertEquals("IntegerMatrix 2x2 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 4}, {2, 4} }); - assertEquals("IntegerMatrix 2x2 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //3x3 matrix = new IntegerMatrix(grid3); @@ -1195,7 +1195,7 @@ public class TestIntegerMatrix{ {12, 18, 24}, {12, 18, 24} }); - assertEquals("IntegerMatrix 3x3 failed multiplication IntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new IntegerMatrix(new int[][]{ {2}, {3}, @@ -1206,13 +1206,13 @@ public class TestIntegerMatrix{ {20}, {20} }); - assertEquals("IntegerMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 4, 6}, {2, 4, 6}, {2, 4, 6} }); - assertEquals("IntegerMatrix 3x3 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //4x4 matrix = new IntegerMatrix(grid4); @@ -1223,7 +1223,7 @@ public class TestIntegerMatrix{ {20, 30, 40, 50}, {20, 30, 40, 50}, }); - assertEquals("IntegerMatrix 4x4 failed multiplication IntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new IntegerMatrix(new int[][]{ {2}, {3}, @@ -1236,14 +1236,14 @@ public class TestIntegerMatrix{ {40}, {40} }); - assertEquals("IntegerMatrix 4x4 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8} }); - assertEquals("IntegerMatrix 4x4 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //10x10 matrix = new IntegerMatrix(grid10); @@ -1260,7 +1260,7 @@ public class TestIntegerMatrix{ {110, 165, 220, 275, 330, 385, 440, 495, 550, 605}, {110, 165, 220, 275, 330, 385, 440, 495, 550, 605} }); - assertEquals("IntegerMatrix 10x10 failed multiplication IntegerMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new IntegerMatrix(new int[][]{ {2}, {3}, @@ -1285,7 +1285,7 @@ public class TestIntegerMatrix{ {440}, {440} }); - assertEquals("IntegerMatrix 10x10 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new IntegerMatrix(new int[][]{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, @@ -1298,7 +1298,7 @@ public class TestIntegerMatrix{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} }); - assertEquals("IntegerMatrix 10x10 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); } @Test @@ -1306,7 +1306,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix transformMatrix = new IntegerMatrix(transformGrid1_2); - assertEquals("IntegerMatrix 1x1 failed dot product IntegerMatrix.", 2, matrix.dotProduct(transformMatrix)); + assertEquals(2, matrix.dotProduct(transformMatrix)); //Invalid products IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -1318,22 +1318,22 @@ public class TestIntegerMatrix{ //2x2 matrix = new IntegerMatrix(grid2); transformMatrix = new IntegerMatrix(transformGrid2_2); - assertEquals("IntegerMatrix 2x2 failed dot product IntegerMatrix.", 30, matrix.dotProduct(transformMatrix)); + assertEquals(30, matrix.dotProduct(transformMatrix)); //3x3 matrix = new IntegerMatrix(grid3); transformMatrix = new IntegerMatrix(transformGrid3_2); - assertEquals("IntegerMatrix 3x3 failed dot product IntegerMatrix.", 162, matrix.dotProduct(transformMatrix)); + assertEquals(162, matrix.dotProduct(transformMatrix)); //4x4 matrix = new IntegerMatrix(grid4); transformMatrix = new IntegerMatrix(transformGrid4_2); - assertEquals("IntegerMatrix 4x4 failed dot product IntegerMatrix.", 560, matrix.dotProduct(transformMatrix)); + assertEquals(560, matrix.dotProduct(transformMatrix)); //10x10 matrix = new IntegerMatrix(grid10); transformMatrix = new IntegerMatrix(transformGrid10_2); - assertEquals("IntegerMatrix 10x10 failed dot product IntegerMatrix.", 35750, matrix.dotProduct(transformMatrix)); + assertEquals(35750, matrix.dotProduct(transformMatrix)); } @Test @@ -1342,7 +1342,7 @@ public class TestIntegerMatrix{ IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix transformMatrix = new IntegerMatrix(transformGrid1_2); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{2}}); - assertEquals("IntegerMatrix 1x1 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Invalid hadamard products IntegerMatrix testMatrix = new IntegerMatrix(grid1); @@ -1362,7 +1362,7 @@ public class TestIntegerMatrix{ {2, 6}, {2, 6} }); - assertEquals("IntegerMatrix 2x2 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //3x3 matrix = new IntegerMatrix(grid3); @@ -1372,7 +1372,7 @@ public class TestIntegerMatrix{ {2, 6, 12}, {2, 6, 12} }); - assertEquals("IntegerMatrix 3x3 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //4x4 matrix = new IntegerMatrix(grid4); @@ -1383,7 +1383,7 @@ public class TestIntegerMatrix{ {2, 6, 12, 20}, {2, 6, 12, 20} }); - assertEquals("IntegerMatrix 4x4 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //10x10 matrix = new IntegerMatrix(grid10); @@ -1400,7 +1400,7 @@ public class TestIntegerMatrix{ {2, 6, 12, 20, 30, 42, 56, 72, 90, 110}, {2, 6, 12, 20, 30, 42, 56, 72, 90, 110} }); - assertEquals("IntegerMatrix 10x10 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); } @Test @@ -1408,7 +1408,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); - assertEquals("IntegerMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //2x2 matrix = new IntegerMatrix(grid2); @@ -1416,7 +1416,7 @@ public class TestIntegerMatrix{ {1, 1}, {2, 2} }); - assertEquals("IntegerMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //3x3 matrix = new IntegerMatrix(grid3); @@ -1425,7 +1425,7 @@ public class TestIntegerMatrix{ {2, 2, 2}, {3, 3, 3} }); - assertEquals("IntegerMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //4x4 matrix = new IntegerMatrix(grid4); @@ -1435,7 +1435,7 @@ public class TestIntegerMatrix{ {3, 3, 3, 3}, {4, 4, 4, 4} }); - assertEquals("IntegerMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //10x10 matrix = new IntegerMatrix(grid10); @@ -1451,14 +1451,14 @@ public class TestIntegerMatrix{ {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, }); - assertEquals("IntegerMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); } @Test public void testDeterminant(){ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); - assertEquals("IntegerMatrix 1x1 failed determinant.", 1, matrix.determinant()); + assertEquals(1, matrix.determinant()); //Invalid determinants IntegerMatrix testMatrix = new IntegerMatrix(new int[][]{{0, 0}}); @@ -1468,35 +1468,35 @@ public class TestIntegerMatrix{ //2x2 matrix = new IntegerMatrix(grid2); - assertEquals("IntegerMatrix 2x2 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new IntegerMatrix(new int[][]{ {1, 4}, {4, 1} }); - assertEquals("IntegerMatrix 2x2 failed determinant2.", -15, matrix.determinant()); + assertEquals(-15, matrix.determinant()); //det assertEquals(matrix.determinant(), matrix.det()); //3x3 matrix = new IntegerMatrix(grid3); - assertEquals("IntegerMatrix 3x3 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new IntegerMatrix(new int[][]{ {1, 4, 2}, {2, 4, 1}, {4, 1, 2} }); - assertEquals("IntegerMatrix 3x3 failed determinant2.", -21, matrix.determinant()); + assertEquals(-21, matrix.determinant()); //4x4 matrix = new IntegerMatrix(grid4); - assertEquals("IntegerMatrix 4x4 failed determiant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new IntegerMatrix(new int[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3} }); - assertEquals("IntegerMatrix 4x4 failed determinant2.", 160, matrix.determinant()); + assertEquals(160, matrix.determinant()); //Column matrix = new IntegerMatrix(new int[][]{ {1, 2, 3, 4}, @@ -1516,7 +1516,7 @@ public class TestIntegerMatrix{ //10x10 matrix = new IntegerMatrix(grid10); - assertEquals("IntegerMatrix 10x10 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new IntegerMatrix(new int[][]{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 1}, @@ -1529,7 +1529,7 @@ public class TestIntegerMatrix{ {9, 10, 1, 2, 3, 4, 5, 6, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1} }); - assertEquals("IntegerMatrix 10x10 failed determinant2.", -10000000, matrix.determinant()); + assertEquals(-10000000, matrix.determinant()); } @Test @@ -1537,7 +1537,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(grid1); - assertEquals("IntegerMatrix 1x1 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //Invalid cofactor IntegerMatrix testMatrix = new IntegerMatrix(new int[][]{{0, 0}}); @@ -1551,14 +1551,14 @@ public class TestIntegerMatrix{ {2, -1}, {-2, 1} }); - assertEquals("IntegerMatrix 2x2 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //cof assertEquals(matrix.cofactor(), matrix.cof()); //3x3 matrix = new IntegerMatrix(grid3); correctMatrix = new IntegerMatrix(3, 3, 0); - assertEquals("IntegerMatrix 3x3 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new IntegerMatrix(new int[][]{ {1, 4, 2}, {2, 4, 1}, @@ -1569,12 +1569,12 @@ public class TestIntegerMatrix{ {-6, -6, 15}, {-4, 3, -4} }); - assertEquals("IntegerMatrix 3x3 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //4x4 matrix = new IntegerMatrix(grid4); correctMatrix = new IntegerMatrix(4, 4, 0); - assertEquals("IntegerMatrix 4x4 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new IntegerMatrix(new int[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, @@ -1587,14 +1587,14 @@ public class TestIntegerMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }); - assertEquals("IntegerMatrix 4x4 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new IntegerMatrix(grid10); correctMatrix = new IntegerMatrix(10, 10, 0); - assertEquals("IntegerMatrix 10x10 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); */ } @@ -1603,7 +1603,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); - assertEquals("IntegerMatrix 1x1 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //Invalid powers final IntegerMatrix testMatrix = new IntegerMatrix(new int[][]{{0}, {0}}); @@ -1621,7 +1621,7 @@ public class TestIntegerMatrix{ {9, 18}, {9, 18} }); - assertEquals("IntegerMatrix 2x2 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //3x3 matrix = new IntegerMatrix(grid3); @@ -1630,7 +1630,7 @@ public class TestIntegerMatrix{ {36, 72, 108}, {36, 72, 108} }); - assertEquals("IntegerMatrix 3x3 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //4x4 //0 @@ -1641,7 +1641,7 @@ public class TestIntegerMatrix{ {1, 1, 1, 1}, {1, 1, 1, 1} }); - assertEquals("IntegerMatrix 4x4 failed power 0.", correctMatrix, matrix.pow(0)); + assertEquals(correctMatrix, matrix.pow(0)); //1 correctMatrix = new IntegerMatrix(new int[][]{ {1, 2, 3, 4}, @@ -1649,7 +1649,7 @@ public class TestIntegerMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("IntegerMatrix 4x4 failed power 1.", correctMatrix, matrix.pow(1)); + assertEquals(correctMatrix, matrix.pow(1)); //3 correctMatrix = new IntegerMatrix(new int[][]{ {100, 200, 300, 400}, @@ -1657,7 +1657,7 @@ public class TestIntegerMatrix{ {100, 200, 300, 400}, {100, 200, 300, 400} }); - assertEquals("IntegerMatrix 4x4 failed power 3.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //10x10 matrix = new IntegerMatrix(grid10); @@ -1673,7 +1673,7 @@ public class TestIntegerMatrix{ {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250}, {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250} }); - assertEquals("IntegerMatrix 10x10 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); } @Test @@ -1681,7 +1681,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(grid1); - assertEquals("IntegerMatrix 1x1 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //2x2 matrix = new IntegerMatrix(grid2); @@ -1689,14 +1689,14 @@ public class TestIntegerMatrix{ {2, -2}, {-1, 1} }); - assertEquals("IntegerMatrix 2x2 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //adj assertEquals(matrix.adjoint(), matrix.adj()); //3x3 matrix = new IntegerMatrix(grid3); correctMatrix = new IntegerMatrix(3, 3, 0); - assertEquals("IntegerMatrix 3x3 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //4x4 matrix = new IntegerMatrix(new int[][]{ @@ -1711,14 +1711,14 @@ public class TestIntegerMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }); - assertEquals("IntegerMatrix 4x4 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new IntegerMatrix(grid10); correctMatrix = new IntegerMatrix(10, 10, 0); - assertEquals("IntegerMatrix 10x10 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); */ } @@ -1727,7 +1727,7 @@ public class TestIntegerMatrix{ //1x1 IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix correctMatrix = new IntegerMatrix(grid1); - assertEquals("IntegerMatrix 1x1 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //Invalid inverse IntegerMatrix testMatrix = new IntegerMatrix(new int[][]{{0, 0}}); @@ -1752,7 +1752,7 @@ public class TestIntegerMatrix{ {-0, 0}, {0, -0} }); - assertEquals("IntegerMatrix 2x2 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //3x3 matrix = new IntegerMatrix(new int[][]{ @@ -1765,7 +1765,7 @@ public class TestIntegerMatrix{ {0, 0, -0}, {0, -0, 0} }); - assertEquals("IntegerMatrix 3x3 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //4x4 matrix = new IntegerMatrix(new int[][]{ @@ -1780,7 +1780,7 @@ public class TestIntegerMatrix{ {0, 0, -0, 0}, {0, -0, 0, 0} }); - assertEquals("IntegerMatrix 4x4 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //10x10 //?Skipped 10x10 because it would take a long time to compute diff --git a/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java b/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java index c0d655e..325c142 100644 --- a/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java +++ b/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java @@ -1,19 +1,19 @@ //Matrix/src/test/java/com/mattrixwv/matrix/TestLongMatrix.java //Mattrixwv // Created: 02-10-22 -//Modified: 07-01-22 +//Modified: 07-09-22 package com.mattrixwv.matrix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.mattrixwv.matrix.exceptions.InvalidCoordinatesException; import com.mattrixwv.matrix.exceptions.InvalidGeometryException; @@ -198,24 +198,24 @@ public class TestLongMatrix{ public void testEquals(){ //Invalid equals LongMatrix matrix = new LongMatrix(grid1); - assertNotEquals(matrix, null); - assertNotEquals(matrix, new int[0]); + assertNotEquals(null, matrix); + assertNotEquals(new int[0], matrix); //1x1 matrix = new LongMatrix(grid1); boolean gridEquals = matrix.equals(matrix); - assertTrue("LongMatrix 1x1 failed equals LongMatrix.", gridEquals); + assertTrue(gridEquals); @SuppressWarnings("unlikely-arg-type") boolean gridEquals1 = matrix.equals(grid1); - assertTrue("LongMatrix 1x1 failed equals long[][].", gridEquals1); + assertTrue(gridEquals1); //2x2 matrix = new LongMatrix(grid2); boolean gridEquals2 = matrix.equals(matrix); - assertTrue("LongMatrix 2x2 failed equals LongMatrix.", gridEquals2); + assertTrue(gridEquals2); @SuppressWarnings("unlikely-arg-type") boolean gridEquals21 = matrix.equals(grid2); - assertTrue("LongMatrix 2x2 failed equals long[][].", gridEquals21); + assertTrue(gridEquals21); //false @SuppressWarnings("unlikely-arg-type") boolean gridEquals22 = matrix.equals(transformGrid2_1); @@ -231,33 +231,33 @@ public class TestLongMatrix{ //3x3 matrix = new LongMatrix(grid3); boolean gridEquals3 = matrix.equals(matrix); - assertTrue("LongMatrix 3x3 failed equals LongMatrix.", gridEquals3); + assertTrue(gridEquals3); @SuppressWarnings("unlikely-arg-type") boolean gridEquals31 = matrix.equals(grid3); - assertTrue("LongMatrix 3x3 failed equals long[][].", gridEquals31); + assertTrue(gridEquals31); //4x4 matrix = new LongMatrix(grid4); boolean gridEquals4 = matrix.equals(matrix); - assertTrue("LongMatrix 4x4 failed equals LongMatrix.", gridEquals4); + assertTrue(gridEquals4); @SuppressWarnings("unlikely-arg-type") boolean gridEquals41 = matrix.equals(grid4); - assertTrue("LongMatrix 4x4 failed equals long[][].", gridEquals41); + assertTrue(gridEquals41); //10x10 matrix = new LongMatrix(grid10); boolean gridEquals10 = matrix.equals(matrix); - assertTrue("LongMatrix = 10x10 failed equals LongMatrix.", gridEquals10); + assertTrue(gridEquals10); @SuppressWarnings("unlikely-arg-type") boolean gridEquals101 = matrix.equals(grid10); - assertTrue("LongMatrix 10x10 failed equals long[][].", gridEquals101); + assertTrue(gridEquals101); } @Test public void testGet(){ //1x1 LongMatrix matrix = new LongMatrix(grid1); - assertEquals("LongMatrix 1x1 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //Invalid gets final LongMatrix testMatrix = new LongMatrix(grid1); @@ -276,19 +276,19 @@ public class TestLongMatrix{ //2x2 matrix = new LongMatrix(grid2); - assertEquals("LongMatrix 2x2 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //3x3 matrix = new LongMatrix(grid3); - assertEquals("LongMatrix 3x3 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //4x4 matrix = new LongMatrix(grid4); - assertEquals("LongMatrix 4x4 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //10x10 matrix = new LongMatrix(grid10); - assertEquals("LongMatrix 10x10 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); } @Test @@ -296,7 +296,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1}}); - assertEquals("LongMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //Invalid gets final LongMatrix testMatrix = new LongMatrix(matrix); @@ -310,23 +310,23 @@ public class TestLongMatrix{ //2x2 matrix = new LongMatrix(grid2); correctMatrix = new LongMatrix(new long[][]{{1, 2}}); - assertEquals("LongMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //3x3 matrix = new LongMatrix(grid3); correctMatrix = new LongMatrix(new long[][]{{1, 2, 3}}); - assertEquals("LongMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //4x4 matrix = new LongMatrix(grid4); matrix = new LongMatrix(grid4); correctMatrix = new LongMatrix(new long[][]{{1, 2, 3, 4}}); - assertEquals("LongMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //10x10 matrix = new LongMatrix(grid10); correctMatrix = new LongMatrix(new long[][]{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}); - assertEquals("LongMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); } @Test @@ -334,7 +334,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1}}); - assertEquals("LongMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //Invalid gets final LongMatrix testMatrix = new LongMatrix(); @@ -355,7 +355,7 @@ public class TestLongMatrix{ {1}, {1} }); - assertEquals("LongMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //3x3 matrix = new LongMatrix(grid3); @@ -364,7 +364,7 @@ public class TestLongMatrix{ {1}, {1} }); - assertEquals("LongMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //4x4 matrix = new LongMatrix(grid4); @@ -374,7 +374,7 @@ public class TestLongMatrix{ {1}, {1} }); - assertEquals("LongMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //10x10 matrix = new LongMatrix(grid10); @@ -390,7 +390,7 @@ public class TestLongMatrix{ {1}, {1} }); - assertEquals("LongMatrix 10x10 failed getColumn.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); } @Test @@ -399,7 +399,7 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); matrix.set(0, 0, 2); LongMatrix correctMatrix = new LongMatrix(new long[][]{{2}}); - assertEquals("LongMatrix 1x1 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid sets final LongMatrix testMatrix = new LongMatrix(grid1); @@ -423,7 +423,7 @@ public class TestLongMatrix{ {3, 2}, {1, 2} }); - assertEquals("LongMatrix 2x2 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //3x3 matrix = new LongMatrix(grid3); @@ -433,7 +433,7 @@ public class TestLongMatrix{ {1, 2, 3}, {1, 2, 3}, }); - assertEquals("LongMatrix 3x3 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new LongMatrix(grid4); @@ -444,7 +444,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new LongMatrix(grid10); @@ -461,7 +461,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("LongMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -470,7 +470,7 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); matrix.setRow(0, new long[]{0}); LongMatrix correctMatrix = new LongMatrix(new long[][]{{0}}); - assertEquals("LongMatrix 1x1 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setRows final LongMatrix testMatrix = new LongMatrix(grid1); @@ -502,7 +502,7 @@ public class TestLongMatrix{ {1, 2}, {2, 1} }); - assertEquals("LongMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix LongMatrix matrix2 = new LongMatrix(new long[][]{{0, 0}}); matrix.setRow(1, matrix2); @@ -520,7 +520,7 @@ public class TestLongMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("LongMatrix 3x3 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new LongMatrix(grid4); @@ -531,7 +531,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new LongMatrix(grid10); @@ -548,7 +548,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("LongMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -557,7 +557,7 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); matrix.setCol(0, new long[]{1}); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1}}); - assertEquals("LongMatrix 1x1 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setCols final LongMatrix testMatrix = new LongMatrix(grid1); @@ -589,7 +589,7 @@ public class TestLongMatrix{ {3, 2}, {3, 2} }); - assertEquals("LongMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix LongMatrix vector = new LongMatrix(new long[][]{{0}, {0}}); matrix.setCol(1, vector); @@ -607,7 +607,7 @@ public class TestLongMatrix{ {0, 2, 3}, {0, 2, 3} }); - assertEquals("LongMatrix 3x3 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new LongMatrix(grid4); @@ -618,7 +618,7 @@ public class TestLongMatrix{ {0, 2, 3, 4}, {0, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new LongMatrix(grid10); @@ -635,7 +635,7 @@ public class TestLongMatrix{ {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("LongMatrix 10x10 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -650,7 +650,7 @@ public class TestLongMatrix{ matrix = new LongMatrix(grid1); matrix.addRow(new long[]{1}); correctMatrix = new LongMatrix(new long[][]{{1}, {1}}); - assertEquals("LongMatrix 1x1 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final LongMatrix testMatrix = new LongMatrix(grid1); @@ -676,7 +676,7 @@ public class TestLongMatrix{ {1, 2}, {1, 2} }); - assertEquals("LongMatrix 2x2 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new LongMatrix(grid2); matrix.addRow(new LongMatrix(new long[][]{{0, 0}})); @@ -696,7 +696,7 @@ public class TestLongMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("LongMatrix 3x3 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new LongMatrix(grid4); @@ -708,7 +708,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new LongMatrix(grid10); @@ -726,7 +726,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("LongMatrix 10x10 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -741,7 +741,7 @@ public class TestLongMatrix{ matrix = new LongMatrix(grid1); matrix.addCol(new long[]{1}); correctMatrix = new LongMatrix(new long[][]{{1, 1}}); - assertEquals("LongMatrix 1x1 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final LongMatrix testMatrix = new LongMatrix(grid1); @@ -766,7 +766,7 @@ public class TestLongMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("LongMatrix 2x2 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new LongMatrix(grid2); matrix.addCol(new LongMatrix(new long[][]{{0}, {0}})); @@ -784,7 +784,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 3x3 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new LongMatrix(grid4); @@ -795,7 +795,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5} }); - assertEquals("LongMatrix 4x4 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new LongMatrix(grid10); @@ -812,7 +812,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }); - assertEquals("LongMatrix 10x10 failed addColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -821,7 +821,7 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); LongMatrix secondMatrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1, 1}}); - assertEquals("LongMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Invalid appends final LongMatrix testMatrix = new LongMatrix(grid1); @@ -840,7 +840,7 @@ public class TestLongMatrix{ {1, 2, 1, 2}, {1, 2, 1, 2} }); - assertEquals("LongMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //3x3 matrix = new LongMatrix(grid3); @@ -850,7 +850,7 @@ public class TestLongMatrix{ {1, 2, 3, 1, 2, 3}, {1, 2, 3, 1, 2, 3} }); - assertEquals("LongMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //4x4 matrix = new LongMatrix(grid4); @@ -861,7 +861,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 1, 2, 3, 4}, {1, 2, 3, 4, 1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //10x10 matrix = new LongMatrix(grid10); @@ -878,7 +878,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }); - assertEquals("LongMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); } @Test @@ -890,7 +890,7 @@ public class TestLongMatrix{ {1}, {1} }); - assertEquals("LongMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Invalid appends final LongMatrix testMatrix = new LongMatrix(grid1); @@ -911,7 +911,7 @@ public class TestLongMatrix{ {1, 2}, {1, 2} }); - assertEquals("LongMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //3x3 matrix = new LongMatrix(grid3); @@ -924,7 +924,7 @@ public class TestLongMatrix{ {1, 2, 3}, {1, 2, 3} }); - assertEquals("LongMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //4x4 matrix = new LongMatrix(grid4); @@ -939,7 +939,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //10x10 matrix = new LongMatrix(grid10); @@ -956,7 +956,7 @@ public class TestLongMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, }); - assertEquals("LongMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); } @Test @@ -977,8 +977,8 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); LongMatrix transformMatrix = new LongMatrix(transformGrid1_1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{2}}); - assertEquals("LongMatrix 1x1 failed add LongMatrix.", correctMatrix, matrix.add(transformMatrix)); - assertEquals("LongMatrix 1x1 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(1)); //Invalid adds final LongMatrix testMatrix = new LongMatrix(grid1); @@ -998,12 +998,12 @@ public class TestLongMatrix{ {2, 2}, {2, 2} }); - assertEquals("LongMatrix 2x2 failed add LongMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {2, 3}, {2, 3} }); - assertEquals("LongMatrix 2x2 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //3x3 matrix = new LongMatrix(grid3); @@ -1013,13 +1013,13 @@ public class TestLongMatrix{ {3, 3, 3}, {3, 3, 3} }); - assertEquals("LongMatrix 3x3 failed add LongMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {2, 3, 4}, {2, 3, 4}, {2, 3, 4} }); - assertEquals("LongMatrix 3x3 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //4x4 matrix = new LongMatrix(grid4); @@ -1030,14 +1030,14 @@ public class TestLongMatrix{ {4, 4, 4, 4}, {4, 4, 4, 4} }); - assertEquals("LongMatrix 4x4 failed add LongMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5} }); - assertEquals("LongMatrix 4x4 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //10x10 matrix = new LongMatrix(grid10); @@ -1054,7 +1054,7 @@ public class TestLongMatrix{ {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} }); - assertEquals("LongMatrix 5x5 failed add LongMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, @@ -1067,7 +1067,7 @@ public class TestLongMatrix{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }); - assertEquals("LongMatrix 10x10 failed add LongMatrix.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); } @Test @@ -1078,8 +1078,8 @@ public class TestLongMatrix{ LongMatrix correctMatrix = new LongMatrix(new long[][]{ {0} }); - assertEquals("LongMatrix 1x1 failed subtract LongMatrix.", correctMatrix, matrix.subtract(transformMatrix)); - assertEquals("LongMatrix 1x1 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(1)); //Invalid subtracts final LongMatrix testMatrix = new LongMatrix(grid1); @@ -1096,43 +1096,43 @@ public class TestLongMatrix{ matrix = new LongMatrix(grid2); transformMatrix = new LongMatrix(grid2); correctMatrix = new LongMatrix(2, 2, 0); - assertEquals("LongMatrix 2x2 failed subtract LongMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {0, 1}, {0, 1} }); - assertEquals("LongMatrix 2x2 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //3x3 matrix = new LongMatrix(grid3); transformMatrix = new LongMatrix(grid3); correctMatrix = new LongMatrix(3, 3, 0); - assertEquals("LongMatrix 3x3 failed subtract LongMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {0, 1, 2}, {0, 1, 2}, {0, 1, 2} }); - assertEquals("LongMatrix 3x3 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //4x4 matrix = new LongMatrix(grid4); transformMatrix = new LongMatrix(grid4); correctMatrix = new LongMatrix(4, 4, 0); - assertEquals("LongMatrix 4x4 failed subtract LongMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3} }); - assertEquals("LongMatrix 4x4 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //10x10 matrix = new LongMatrix(grid10); transformMatrix = new LongMatrix(grid10); correctMatrix = new LongMatrix(10, 10, 0); - assertEquals("LongMatrix 10x10 failed subtract LongMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new LongMatrix(new long[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, @@ -1145,7 +1145,7 @@ public class TestLongMatrix{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} }); - assertEquals("LongMatrix 10x10 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); } @Test @@ -1154,8 +1154,8 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); LongMatrix transformMatrix = new LongMatrix(transformGrid1_2); LongMatrix correctMatrix = new LongMatrix(transformGrid1_2); - assertEquals("LongMatrix 1x1 failed multiplication LongMatrix.", correctMatrix, matrix.multiply(transformMatrix)); - assertEquals("LongMatrix 1x1 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(2)); //Invalid multiplication final LongMatrix testMatrix = new LongMatrix(grid1); @@ -1171,7 +1171,7 @@ public class TestLongMatrix{ {6, 9}, {6, 9} }); - assertEquals("LongMatrix 2x2 failed multiplication LongMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); LongMatrix vector = new LongMatrix(new long[][]{ {2}, {3} @@ -1180,12 +1180,12 @@ public class TestLongMatrix{ {8}, {8} }); - assertEquals("LongMatrix 2x2 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new LongMatrix(new long[][]{ {2, 4}, {2, 4} }); - assertEquals("LongMatrix 2x2 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //3x3 matrix = new LongMatrix(grid3); @@ -1195,7 +1195,7 @@ public class TestLongMatrix{ {12, 18, 24}, {12, 18, 24} }); - assertEquals("LongMatrix 3x3 failed multiplication LongMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new LongMatrix(new long[][]{ {2}, {3}, @@ -1206,13 +1206,13 @@ public class TestLongMatrix{ {20}, {20} }); - assertEquals("LongMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new LongMatrix(new long[][]{ {2, 4, 6}, {2, 4, 6}, {2, 4, 6} }); - assertEquals("LongMatrix 3x3 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //4x4 matrix = new LongMatrix(grid4); @@ -1223,7 +1223,7 @@ public class TestLongMatrix{ {20, 30, 40, 50}, {20, 30, 40, 50}, }); - assertEquals("LongMatrix 4x4 failed multiplication LongMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new LongMatrix(new long[][]{ {2}, {3}, @@ -1236,14 +1236,14 @@ public class TestLongMatrix{ {40}, {40} }); - assertEquals("LongMatrix 4x4 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new LongMatrix(new long[][]{ {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8} }); - assertEquals("LongMatrix 4x4 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //10x10 matrix = new LongMatrix(grid10); @@ -1260,7 +1260,7 @@ public class TestLongMatrix{ {110, 165, 220, 275, 330, 385, 440, 495, 550, 605}, {110, 165, 220, 275, 330, 385, 440, 495, 550, 605} }); - assertEquals("LongMatrix 10x10 failed multiplication LongMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new LongMatrix(new long[][]{ {2}, {3}, @@ -1285,7 +1285,7 @@ public class TestLongMatrix{ {440}, {440} }); - assertEquals("LongMatrix 10x10 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new LongMatrix(new long[][]{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, @@ -1298,7 +1298,7 @@ public class TestLongMatrix{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} }); - assertEquals("LongMatrix 10x10 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); } @Test @@ -1306,7 +1306,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix transformMatrix = new LongMatrix(transformGrid1_2); - assertEquals("LongMatrix 1x1 failed dot product LongMatrix.", 2, matrix.dotProduct(transformMatrix)); + assertEquals(2, matrix.dotProduct(transformMatrix)); //Invalid products LongMatrix testMatrix = new LongMatrix(grid1); @@ -1318,22 +1318,22 @@ public class TestLongMatrix{ //2x2 matrix = new LongMatrix(grid2); transformMatrix = new LongMatrix(transformGrid2_2); - assertEquals("LongMatrix 2x2 failed dot product LongMatrix.", 30, matrix.dotProduct(transformMatrix)); + assertEquals(30, matrix.dotProduct(transformMatrix)); //3x3 matrix = new LongMatrix(grid3); transformMatrix = new LongMatrix(transformGrid3_2); - assertEquals("LongMatrix 3x3 failed dot product LongMatrix.", 162, matrix.dotProduct(transformMatrix)); + assertEquals(162, matrix.dotProduct(transformMatrix)); //4x4 matrix = new LongMatrix(grid4); transformMatrix = new LongMatrix(transformGrid4_2); - assertEquals("LongMatrix 4x4 failed dot product LongMatrix.", 560, matrix.dotProduct(transformMatrix)); + assertEquals(560, matrix.dotProduct(transformMatrix)); //10x10 matrix = new LongMatrix(grid10); transformMatrix = new LongMatrix(transformGrid10_2); - assertEquals("LongMatrix 10x10 failed dot product LongMatrix.", 35750, matrix.dotProduct(transformMatrix)); + assertEquals(35750, matrix.dotProduct(transformMatrix)); } @Test @@ -1342,7 +1342,7 @@ public class TestLongMatrix{ LongMatrix matrix = new LongMatrix(grid1); LongMatrix transformMatrix = new LongMatrix(transformGrid1_2); LongMatrix correctMatrix = new LongMatrix(new long[][]{{2}}); - assertEquals("LongMatrix 1x1 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Invalid hadamard products LongMatrix testMatrix = new LongMatrix(grid1); @@ -1362,7 +1362,7 @@ public class TestLongMatrix{ {2, 6}, {2, 6} }); - assertEquals("LongMatrix 2x2 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //3x3 matrix = new LongMatrix(grid3); @@ -1372,7 +1372,7 @@ public class TestLongMatrix{ {2, 6, 12}, {2, 6, 12} }); - assertEquals("LongMatrix 3x3 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //4x4 matrix = new LongMatrix(grid4); @@ -1383,7 +1383,7 @@ public class TestLongMatrix{ {2, 6, 12, 20}, {2, 6, 12, 20} }); - assertEquals("LongMatrix 4x4 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //10x10 matrix = new LongMatrix(grid10); @@ -1400,7 +1400,7 @@ public class TestLongMatrix{ {2, 6, 12, 20, 30, 42, 56, 72, 90, 110}, {2, 6, 12, 20, 30, 42, 56, 72, 90, 110} }); - assertEquals("LongMatrix 10x10 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); } @Test @@ -1408,7 +1408,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1}}); - assertEquals("LongMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //2x2 matrix = new LongMatrix(grid2); @@ -1416,7 +1416,7 @@ public class TestLongMatrix{ {1, 1}, {2, 2} }); - assertEquals("LongMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //3x3 matrix = new LongMatrix(grid3); @@ -1425,7 +1425,7 @@ public class TestLongMatrix{ {2, 2, 2}, {3, 3, 3} }); - assertEquals("LongMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //4x4 matrix = new LongMatrix(grid4); @@ -1435,7 +1435,7 @@ public class TestLongMatrix{ {3, 3, 3, 3}, {4, 4, 4, 4} }); - assertEquals("LongMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //10x10 matrix = new LongMatrix(grid10); @@ -1451,14 +1451,14 @@ public class TestLongMatrix{ {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, }); - assertEquals("LongMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); } @Test public void testDeterminant(){ //1x1 LongMatrix matrix = new LongMatrix(grid1); - assertEquals("LongMatrix 1x1 failed determinant.", 1, matrix.determinant()); + assertEquals(1, matrix.determinant()); //Invalid determinants LongMatrix testMatrix = new LongMatrix(new long[][]{{0, 0}}); @@ -1468,35 +1468,35 @@ public class TestLongMatrix{ //2x2 matrix = new LongMatrix(grid2); - assertEquals("LongMatrix 2x2 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new LongMatrix(new long[][]{ {1, 4}, {4, 1} }); - assertEquals("LongMatrix 2x2 failed determinant2.", -15, matrix.determinant()); + assertEquals(-15, matrix.determinant()); //det assertEquals(matrix.determinant(), matrix.det()); //3x3 matrix = new LongMatrix(grid3); - assertEquals("LongMatrix 3x3 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new LongMatrix(new long[][]{ {1, 4, 2}, {2, 4, 1}, {4, 1, 2} }); - assertEquals("LongMatrix 3x3 failed determinant2.", -21, matrix.determinant()); + assertEquals(-21, matrix.determinant()); //4x4 matrix = new LongMatrix(grid4); - assertEquals("LongMatrix 4x4 failed determiant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new LongMatrix(new long[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3} }); - assertEquals("LongMatrix 4x4 failed determinant2.", 160, matrix.determinant()); + assertEquals(160, matrix.determinant()); //Column matrix = new LongMatrix(new long[][]{ {1, 2, 3, 4}, @@ -1516,7 +1516,7 @@ public class TestLongMatrix{ //10x10 matrix = new LongMatrix(grid10); - assertEquals("LongMatrix 10x10 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new LongMatrix(new long[][]{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 1}, @@ -1529,7 +1529,7 @@ public class TestLongMatrix{ {9, 10, 1, 2, 3, 4, 5, 6, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1} }); - assertEquals("LongMatrix 10x10 failed determinant2.", -10000000, matrix.determinant()); + assertEquals(-10000000, matrix.determinant()); } @Test @@ -1537,7 +1537,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(grid1); - assertEquals("LongMatrix 1x1 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //Invalid cofactor LongMatrix testMatrix = new LongMatrix(new long[][]{{0, 0}}); @@ -1551,14 +1551,14 @@ public class TestLongMatrix{ {2, -1}, {-2, 1} }); - assertEquals("LongMatrix 2x2 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //cof assertEquals(matrix.cofactor(), matrix.cof()); //3x3 matrix = new LongMatrix(grid3); correctMatrix = new LongMatrix(3, 3, 0); - assertEquals("LongMatrix 3x3 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new LongMatrix(new long[][]{ {1, 4, 2}, {2, 4, 1}, @@ -1569,12 +1569,12 @@ public class TestLongMatrix{ {-6, -6, 15}, {-4, 3, -4} }); - assertEquals("LongMatrix 3x3 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //4x4 matrix = new LongMatrix(grid4); correctMatrix = new LongMatrix(4, 4, 0); - assertEquals("LongMatrix 4x4 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new LongMatrix(new long[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, @@ -1587,14 +1587,14 @@ public class TestLongMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }); - assertEquals("LongMatrix 4x4 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new LongMatrix(grid10); correctMatrix = new LongMatrix(10, 10, 0); - assertEquals("LongMatrix 10x10 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); */ } @@ -1603,7 +1603,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(new long[][]{{1}}); - assertEquals("LongMatrix 1x1 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //Invalid powers final LongMatrix testMatrix = new LongMatrix(new long[][]{{0}, {0}}); @@ -1621,7 +1621,7 @@ public class TestLongMatrix{ {9, 18}, {9, 18} }); - assertEquals("LongMatrix 2x2 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //3x3 matrix = new LongMatrix(grid3); @@ -1630,7 +1630,7 @@ public class TestLongMatrix{ {36, 72, 108}, {36, 72, 108} }); - assertEquals("LongMatrix 3x3 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //4x4 //0 @@ -1641,7 +1641,7 @@ public class TestLongMatrix{ {1, 1, 1, 1}, {1, 1, 1, 1} }); - assertEquals("LongMatrix 4x4 failed power 0.", correctMatrix, matrix.pow(0)); + assertEquals(correctMatrix, matrix.pow(0)); //1 correctMatrix = new LongMatrix(new long[][]{ {1, 2, 3, 4}, @@ -1649,7 +1649,7 @@ public class TestLongMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }); - assertEquals("LongMatrix 4x4 failed power 1.", correctMatrix, matrix.pow(1)); + assertEquals(correctMatrix, matrix.pow(1)); //3 correctMatrix = new LongMatrix(new long[][]{ {100, 200, 300, 400}, @@ -1657,7 +1657,7 @@ public class TestLongMatrix{ {100, 200, 300, 400}, {100, 200, 300, 400} }); - assertEquals("LongMatrix 4x4 failed power 3.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //10x10 matrix = new LongMatrix(grid10); @@ -1673,7 +1673,7 @@ public class TestLongMatrix{ {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250}, {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250} }); - assertEquals("LongMatrix 10x10 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); } @Test @@ -1681,7 +1681,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(grid1); - assertEquals("LongMatrix 1x1 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //2x2 matrix = new LongMatrix(grid2); @@ -1689,14 +1689,14 @@ public class TestLongMatrix{ {2, -2}, {-1, 1} }); - assertEquals("LongMatrix 2x2 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //adj assertEquals(matrix.adjoint(), matrix.adj()); //3x3 matrix = new LongMatrix(grid3); correctMatrix = new LongMatrix(3, 3, 0); - assertEquals("LongMatrix 3x3 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //4x4 matrix = new LongMatrix(new long[][]{ @@ -1711,14 +1711,14 @@ public class TestLongMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }); - assertEquals("LongMatrix 4x4 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new LongMatrix(grid10); correctMatrix = new LongMatrix(10, 10, 0); - assertEquals("LongMatrix 10x10 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); */ } @@ -1727,7 +1727,7 @@ public class TestLongMatrix{ //1x1 LongMatrix matrix = new LongMatrix(grid1); LongMatrix correctMatrix = new LongMatrix(grid1); - assertEquals("LongMatrix 1x1 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //Invalid inverse LongMatrix testMatrix = new LongMatrix(new long[][]{{0, 0}}); @@ -1752,7 +1752,7 @@ public class TestLongMatrix{ {-0, 0}, {0, -0} }); - assertEquals("LongMatrix 2x2 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //3x3 matrix = new LongMatrix(new long[][]{ @@ -1765,7 +1765,7 @@ public class TestLongMatrix{ {0, 0, -0}, {0, -0, 0} }); - assertEquals("LongMatrix 3x3 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //4x4 matrix = new LongMatrix(new long[][]{ @@ -1780,7 +1780,7 @@ public class TestLongMatrix{ {0, 0, -0, 0}, {0, -0, 0, 0} }); - assertEquals("LongMatrix 4x4 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //10x10 //?Skipped 10x10 because it would take a long time to compute diff --git a/src/test/java/com/mattrixwv/matrix/TestModMatrix.java b/src/test/java/com/mattrixwv/matrix/TestModMatrix.java index 13661da..aff7e8a 100644 --- a/src/test/java/com/mattrixwv/matrix/TestModMatrix.java +++ b/src/test/java/com/mattrixwv/matrix/TestModMatrix.java @@ -1,19 +1,19 @@ //Matrix/src/test/java/com/mattixwv/matrix/TestModMatrix.java //Mattrixwv // Created: 02-09-22 -//Modified: 02-09-22 +//Modified: 07-09-22 package com.mattrixwv.matrix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.mattrixwv.matrix.exceptions.InvalidCoordinatesException; import com.mattrixwv.matrix.exceptions.InvalidGeometryException; @@ -137,22 +137,22 @@ public class TestModMatrix{ public void testEquals(){ //Invalid equals ModMatrix matrix = new ModMatrix(grid1, 26); - assertNotEquals(matrix, null); - assertNotEquals(matrix, new double[0]); + assertNotEquals(null, matrix); + assertNotEquals(new double[0], matrix); //1x1 matrix = new ModMatrix(grid1, 26); - assertTrue("ModMatrix 1x1 failed equals ModMatrix.", matrix.equals(matrix)); + assertTrue(matrix.equals(matrix)); @SuppressWarnings("unlikely-arg-type") boolean gridEquals = matrix.equals(grid1); - assertTrue("ModMatrix 1x1 failed equals int[][].", gridEquals); + assertTrue(gridEquals); //2x2 matrix = new ModMatrix(grid2, 26); - assertTrue("ModMatrix 2x2 failed equals ModMatrix.", matrix.equals(matrix)); + assertTrue(matrix.equals(matrix)); @SuppressWarnings("unlikely-arg-type") boolean gridEquals2 = matrix.equals(grid2); - assertTrue("ModMatrix 2x2 failed equals int[][].", gridEquals2); + assertTrue(gridEquals2); //false @SuppressWarnings("unlikely-arg-type") boolean gridEquals22 = matrix.equals(transformGrid2_1); @@ -167,31 +167,31 @@ public class TestModMatrix{ //3x3 matrix = new ModMatrix(grid3, 26); - assertTrue("ModMatrix 3x3 failed equals ModMatrix.", matrix.equals(matrix)); + assertTrue(matrix.equals(matrix)); @SuppressWarnings("unlikely-arg-type") boolean gridEquals3 = matrix.equals(grid3); - assertTrue("ModMatrix 3x3 failed equals int[][].", gridEquals3); + assertTrue(gridEquals3); //4x4 matrix = new ModMatrix(grid4, 26); - assertTrue("ModMatrix 4x4 failed equals ModMatrix.", matrix.equals(matrix)); + assertTrue(matrix.equals(matrix)); @SuppressWarnings("unlikely-arg-type") boolean gridEquals4 = matrix.equals(grid4); - assertTrue("ModMatrix 4x4 failed equals int[][].", gridEquals4); + assertTrue(gridEquals4); //10x10 matrix = new ModMatrix(grid10, 26); - assertTrue("ModMatrix 10x10 failed equals ModMatrix.", matrix.equals(matrix)); + assertTrue(matrix.equals(matrix)); @SuppressWarnings("unlikely-arg-type") boolean gridEquals10 = matrix.equals(grid10); - assertTrue("ModMatrix 10x10 failed equals int[][].", gridEquals10); + assertTrue(gridEquals10); } @Test public void testGet(){ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); - assertEquals("ModMatrix 1x1 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //mod assertEquals(26, matrix.getMod()); @@ -212,19 +212,19 @@ public class TestModMatrix{ //2x2 matrix = new ModMatrix(grid2, 26); - assertEquals("ModMatrix 2x2 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //3x3 matrix = new ModMatrix(grid3, 26); - assertEquals("ModMatrix 3x3 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //4x4 matrix = new ModMatrix(grid4, 26); - assertEquals("ModMatrix 4x4 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); //10x10 matrix = new ModMatrix(grid10, 26); - assertEquals("ModMatrix 10x10 failed get.", 1, matrix.get(0, 0)); + assertEquals(1, matrix.get(0, 0)); } @Test @@ -232,7 +232,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1}}, 26); - assertEquals("ModMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //Invalid gets final ModMatrix testMatrix = new ModMatrix(matrix); @@ -246,22 +246,22 @@ public class TestModMatrix{ //2x2 matrix = new ModMatrix(grid2, 26); correctMatrix = new ModMatrix(new int[][]{{1, 2}}, 26); - assertEquals("ModMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //3x3 matrix = new ModMatrix(grid3, 26); correctMatrix = new ModMatrix(new int[][]{{1, 2, 3}}, 26); - assertEquals("ModMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //4x4 matrix = new ModMatrix(grid4, 26); correctMatrix = new ModMatrix(new int[][]{{1, 2, 3, 4}}, 26); - assertEquals("ModMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); //10x10 matrix = new ModMatrix(grid10, 26); correctMatrix = new ModMatrix(new int[][]{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}, 26); - assertEquals("ModMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0)); + assertEquals(correctMatrix, matrix.getRow(0)); } @Test @@ -269,7 +269,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1}}, 26); - assertEquals("ModMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //Invalid gets final ModMatrix testMatrix = new ModMatrix(26); @@ -290,7 +290,7 @@ public class TestModMatrix{ {1}, {1}, }, 26); - assertEquals("ModMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //3x3 matrix = new ModMatrix(grid3, 26); @@ -299,7 +299,7 @@ public class TestModMatrix{ {1}, {1} }, 26); - assertEquals("ModMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -309,7 +309,7 @@ public class TestModMatrix{ {1}, {1} }, 26); - assertEquals("ModMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -325,7 +325,7 @@ public class TestModMatrix{ {1}, {1} }, 26); - assertEquals("ModMatrix 10x10 failed getColumn.", correctMatrix, matrix.getCol(0)); + assertEquals(correctMatrix, matrix.getCol(0)); } @Test @@ -334,7 +334,7 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); matrix.set(0, 0, 2); ModMatrix correctMatrix = new ModMatrix(new int[][]{{2}}, 26); - assertEquals("ModMatrix 1x1 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid sets final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -358,7 +358,7 @@ public class TestModMatrix{ {3, 2}, {1, 2} }, 26); - assertEquals("ModMatrix 2x2 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //3x3 matrix = new ModMatrix(grid3, 26); @@ -368,7 +368,7 @@ public class TestModMatrix{ {1, 2, 3}, {1, 2, 3}, }, 26); - assertEquals("ModMatrix 3x3 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new ModMatrix(grid4, 26); @@ -379,7 +379,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new ModMatrix(grid10, 26); @@ -396,7 +396,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }, 26); - assertEquals("ModMatrix 10x10 failed set.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -405,7 +405,7 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); matrix.setRow(0, new int[]{0}); ModMatrix correctMatrix = new ModMatrix(new int[][]{{0}}, 26); - assertEquals("ModMatrix 1x1 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setRows final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -437,7 +437,7 @@ public class TestModMatrix{ {1, 2}, {2, 1} }, 26); - assertEquals("ModMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix ModMatrix matrix2 = new ModMatrix(new int[][]{{0, 0}}, 26); matrix.setRow(1, matrix2); @@ -463,7 +463,7 @@ public class TestModMatrix{ {1, 2, 3}, {1, 2, 3} }, 26); - assertEquals("ModMatrix 3x3 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new ModMatrix(grid4, 26); @@ -474,7 +474,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new ModMatrix(grid10, 26); @@ -491,7 +491,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }, 26); - assertEquals("ModMatrix 10x10 failed setRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -500,7 +500,7 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); matrix.setCol(0, new int[]{1}); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1}}, 26); - assertEquals("ModMatrix 1x1 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid setCols final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -532,7 +532,7 @@ public class TestModMatrix{ {3, 2}, {3, 2} }, 26); - assertEquals("ModMatrix 2x2 failed set row.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix ModMatrix vector = new ModMatrix(new int[][]{{0}, {0}}, 26); matrix.setCol(1, vector); @@ -558,7 +558,7 @@ public class TestModMatrix{ {0, 2, 3}, {0, 2, 3} }, 26); - assertEquals("ModMatrix 3x3 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new ModMatrix(grid4, 26); @@ -569,7 +569,7 @@ public class TestModMatrix{ {0, 2, 3, 4}, {0, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed setCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new ModMatrix(grid10, 26); @@ -586,7 +586,7 @@ public class TestModMatrix{ {0, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 2, 3, 4, 5, 6, 7, 8, 9, 10} }, 26); - assertEquals("ModMatrix 10x10 failed setColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -601,7 +601,7 @@ public class TestModMatrix{ matrix = new ModMatrix(grid1, 26); matrix.addRow(new int[]{1}); correctMatrix = new ModMatrix(new int[][]{{1}, {1}}, 26); - assertEquals("ModMatrix 1x1 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid addsd final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -627,7 +627,7 @@ public class TestModMatrix{ {1, 2}, {1, 2} }, 26); - assertEquals("ModMatrix 2x2 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new ModMatrix(grid2, 26); matrix.addRow(new ModMatrix(new int[][]{{0, 0}}, 26)); @@ -655,7 +655,7 @@ public class TestModMatrix{ {1, 2, 3}, {1, 2, 3} }, 26); - assertEquals("ModMatrix 3x3 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new ModMatrix(grid4, 26); @@ -667,7 +667,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new ModMatrix(grid10, 26); @@ -685,7 +685,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }, 26); - assertEquals("ModMatrix 10x10 failed addRow.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -700,7 +700,7 @@ public class TestModMatrix{ matrix = new ModMatrix(grid1, 26); matrix.addCol(new int[]{1}); correctMatrix = new ModMatrix(new int[][]{{1, 1}}, 26); - assertEquals("ModMatrix 1x1 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Invalid adds final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -725,7 +725,7 @@ public class TestModMatrix{ {1, 2, 3}, {1, 2, 3} }, 26); - assertEquals("ModMatrix 2x2 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //Matrix matrix = new ModMatrix(grid2, 26); matrix.addCol(new ModMatrix(new int[][]{{0}, {0}}, 26)); @@ -751,7 +751,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 3x3 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //4x4 matrix = new ModMatrix(grid4, 26); @@ -762,7 +762,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5} }, 26); - assertEquals("ModMatrix 4x4 failed addCol.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); //10x10 matrix = new ModMatrix(grid10, 26); @@ -779,7 +779,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }, 26); - assertEquals("ModMatrix 10x10 failed addColumn.", correctMatrix, matrix); + assertEquals(correctMatrix, matrix); } @Test @@ -788,7 +788,7 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix secondMatrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1, 1}}, 26); - assertEquals("ModMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Invalid appends final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -807,7 +807,7 @@ public class TestModMatrix{ {1, 2, 1, 2}, {1, 2, 1, 2} }, 26); - assertEquals("ModMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //Integer matrix IntegerMatrix thirdMatrix = new IntegerMatrix(grid2); assertEquals(correctMatrix, matrix.appendRight(thirdMatrix)); @@ -820,7 +820,7 @@ public class TestModMatrix{ {1, 2, 3, 1, 2, 3}, {1, 2, 3, 1, 2, 3} }, 26); - assertEquals("ModMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -831,7 +831,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 1, 2, 3, 4}, {1, 2, 3, 4, 1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -848,7 +848,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} }, 26); - assertEquals("ModMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix)); + assertEquals(correctMatrix, matrix.appendRight(secondMatrix)); } @Test @@ -860,7 +860,7 @@ public class TestModMatrix{ {1}, {1} }, 26); - assertEquals("ModMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Invalid appends final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -881,7 +881,7 @@ public class TestModMatrix{ {1, 2}, {1, 2} }, 26); - assertEquals("ModMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //Integer matrix IntegerMatrix thirdMatrix = new IntegerMatrix(grid2); assertEquals(correctMatrix, matrix.appendBottom(thirdMatrix)); @@ -897,7 +897,7 @@ public class TestModMatrix{ {1, 2, 3}, {1, 2, 3} }, 26); - assertEquals("ModMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -912,7 +912,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -929,7 +929,7 @@ public class TestModMatrix{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, }, 26); - assertEquals("ModMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix)); + assertEquals(correctMatrix, matrix.appendBottom(secondMatrix)); } @Test @@ -950,8 +950,8 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix transformMatrix = new ModMatrix(transformGrid1_1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{2}}, 26); - assertEquals("ModMatrix 1x1 failed add ModMatrix.", correctMatrix, matrix.add(transformMatrix)); - assertEquals("ModMatrix 1x1 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(1)); //Invalid adds final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -971,12 +971,12 @@ public class TestModMatrix{ {2, 2}, {2, 2} }, 26); - assertEquals("ModMatrix 2x2 failed add ModMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {2, 3}, {2, 3} }, 26); - assertEquals("ModMatrix 2x2 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //Integer matrix IntegerMatrix transformMatrix2 = new IntegerMatrix(transformGrid2_1); correctMatrix = new ModMatrix(new int[][]{ @@ -993,13 +993,13 @@ public class TestModMatrix{ {3, 3, 3}, {3, 3, 3} }, 26); - assertEquals("ModMatrix 3x3 failed add ModMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {2, 3, 4}, {2, 3, 4}, {2, 3, 4} }, 26); - assertEquals("ModMatrix 3x3 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -1010,14 +1010,14 @@ public class TestModMatrix{ {4, 4, 4, 4}, {4, 4, 4, 4} }, 26); - assertEquals("ModMatrix 4x4 failed add ModMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5}, {2, 3, 4, 5} }, 26); - assertEquals("ModMatrix 4x4 failed add scalar.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -1034,7 +1034,7 @@ public class TestModMatrix{ {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} }, 26); - assertEquals("ModMatrix 5x5 failed add ModMatrix.", correctMatrix, matrix.add(transformMatrix)); + assertEquals(correctMatrix, matrix.add(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, @@ -1047,7 +1047,7 @@ public class TestModMatrix{ {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 11} }, 26); - assertEquals("ModMatrix 10x10 failed add ModMatrix.", correctMatrix, matrix.add(1)); + assertEquals(correctMatrix, matrix.add(1)); } @Test @@ -1058,8 +1058,8 @@ public class TestModMatrix{ ModMatrix correctMatrix = new ModMatrix(new int[][]{ {0} }, 26); - assertEquals("ModMatrix 1x1 failed subtract ModMatrix.", correctMatrix, matrix.subtract(transformMatrix)); - assertEquals("ModMatrix 1x1 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(1)); //Invalid subtracts final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -1076,12 +1076,12 @@ public class TestModMatrix{ matrix = new ModMatrix(grid2, 26); transformMatrix = new ModMatrix(grid2, 26); correctMatrix = new ModMatrix(2, 2, 0, 26); - assertEquals("ModMatrix 2x2 failed subtract ModMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {0, 1}, {0, 1} }, 26); - assertEquals("ModMatrix 2x2 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //Integer matrix IntegerMatrix transformMatrix2 = new IntegerMatrix(grid2); correctMatrix = new ModMatrix(2, 2, 0, 26); @@ -1091,32 +1091,32 @@ public class TestModMatrix{ matrix = new ModMatrix(grid3, 26); transformMatrix = new ModMatrix(grid3, 26); correctMatrix = new ModMatrix(3, 3, 0, 26); - assertEquals("ModMatrix 3x3 failed subtract ModMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {0, 1, 2}, {0, 1, 2}, {0, 1, 2} }, 26); - assertEquals("ModMatrix 3x3 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //4x4 matrix = new ModMatrix(grid4, 26); transformMatrix = new ModMatrix(grid4, 26); correctMatrix = new ModMatrix(4, 4, 0, 26); - assertEquals("ModMatrix 4x4 failed subtract ModMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3}, {0, 1, 2, 3} }, 26); - assertEquals("ModMatrix 4x4 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); //10x10 matrix = new ModMatrix(grid10, 26); transformMatrix = new ModMatrix(grid10, 26); correctMatrix = new ModMatrix(10, 10, 0, 26); - assertEquals("ModMatrix 10x10 failed subtract ModMatrix.", correctMatrix, matrix.subtract(transformMatrix)); + assertEquals(correctMatrix, matrix.subtract(transformMatrix)); correctMatrix = new ModMatrix(new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, @@ -1129,7 +1129,7 @@ public class TestModMatrix{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} }, 26); - assertEquals("ModMatrix 10x10 failed subtract scalar.", correctMatrix, matrix.subtract(1)); + assertEquals(correctMatrix, matrix.subtract(1)); } @Test @@ -1138,8 +1138,8 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix transformMatrix = new ModMatrix(transformGrid1_2, 26); ModMatrix correctMatrix = new ModMatrix(transformGrid1_2, 26); - assertEquals("ModMatrix 1x1 failed multiplication ModMatrix.", correctMatrix, matrix.multiply(transformMatrix)); - assertEquals("ModMatrix 1x1 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(2)); //Invalid multiplication final ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -1155,7 +1155,7 @@ public class TestModMatrix{ {6, 9}, {6, 9} }, 26); - assertEquals("ModMatrix 2x2 failed multiplication ModMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); ModMatrix vector = new ModMatrix(new int[][]{ {2}, {3} @@ -1164,12 +1164,12 @@ public class TestModMatrix{ {8}, {8} }, 26); - assertEquals("ModMatrix 2x2 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new ModMatrix(new int[][]{ {2, 4}, {2, 4} }, 26); - assertEquals("ModMatrix 2x2 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //Integer matrix IntegerMatrix transformMatrix2 = new IntegerMatrix(transformGrid2_2); correctMatrix = new ModMatrix(new int[][]{ @@ -1186,7 +1186,7 @@ public class TestModMatrix{ {12, 18, 24}, {12, 18, 24} }, 26); - assertEquals("ModMatrix 3x3 failed multiplication ModMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new ModMatrix(new int[][]{ {2}, {3}, @@ -1197,13 +1197,13 @@ public class TestModMatrix{ {20}, {20} }, 26); - assertEquals("ModMatrix 3x3 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new ModMatrix(new int[][]{ {2, 4, 6}, {2, 4, 6}, {2, 4, 6} }, 26); - assertEquals("ModMatrix 3x3 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -1214,7 +1214,7 @@ public class TestModMatrix{ {20, 30, 40, 50}, {20, 30, 40, 50}, }, 26); - assertEquals("ModMatrix 4x4 failed multiplication ModMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new ModMatrix(new int[][]{ {2}, {3}, @@ -1227,14 +1227,14 @@ public class TestModMatrix{ {40}, {40} }, 26); - assertEquals("ModMatrix 4x4 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new ModMatrix(new int[][]{ {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8}, {2, 4, 6, 8} }, 26); - assertEquals("ModMatrix 4x4 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -1251,7 +1251,7 @@ public class TestModMatrix{ {110, 165, 220, 275, 330, 385, 440, 495, 550, 605}, {110, 165, 220, 275, 330, 385, 440, 495, 550, 605} }, 26); - assertEquals("ModMatrix 10x10 failed multiplication ModMatrix.", correctMatrix, matrix.multiply(transformMatrix)); + assertEquals(correctMatrix, matrix.multiply(transformMatrix)); vector = new ModMatrix(new int[][]{ {2}, {3}, @@ -1276,7 +1276,7 @@ public class TestModMatrix{ {440}, {440} }, 26); - assertEquals("ModMatrix 10x10 failed multiplication vector.", correctMatrix, matrix.multiply(vector)); + assertEquals(correctMatrix, matrix.multiply(vector)); correctMatrix = new ModMatrix(new int[][]{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, @@ -1289,7 +1289,7 @@ public class TestModMatrix{ {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}, {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} }, 26); - assertEquals("ModMatrix 10x10 failed multiplication scalar.", correctMatrix, matrix.multiply(2)); + assertEquals(correctMatrix, matrix.multiply(2)); } @Test @@ -1297,7 +1297,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix transformMatrix = new ModMatrix(transformGrid1_2, 26); - assertEquals("ModMatrix 1x1 failed dot product ModMatrix.", 2, matrix.dotProduct(transformMatrix)); + assertEquals(2, matrix.dotProduct(transformMatrix)); //Invalid products ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -1309,7 +1309,7 @@ public class TestModMatrix{ //2x2 matrix = new ModMatrix(grid2, 26); transformMatrix = new ModMatrix(transformGrid2_2, 26); - assertEquals("ModMatrix 2x2 failed dot product ModMatrix.", 30, matrix.dotProduct(transformMatrix)); + assertEquals(30, matrix.dotProduct(transformMatrix)); //Integer matrix IntegerMatrix transformMatrix2 = new IntegerMatrix(transformGrid2_2); assertEquals(30, matrix.dotProduct(transformMatrix2)); @@ -1317,17 +1317,17 @@ public class TestModMatrix{ //3x3 matrix = new ModMatrix(grid3, 26); transformMatrix = new ModMatrix(transformGrid3_2, 26); - assertEquals("ModMatrix 3x3 failed dot product ModMatrix.", 162, matrix.dotProduct(transformMatrix)); + assertEquals(162, matrix.dotProduct(transformMatrix)); //4x4 matrix = new ModMatrix(grid4, 26); transformMatrix = new ModMatrix(transformGrid4_2, 26); - assertEquals("ModMatrix 4x4 failed dot product ModMatrix.", 560, matrix.dotProduct(transformMatrix)); + assertEquals(560, matrix.dotProduct(transformMatrix)); //10x10 matrix = new ModMatrix(grid10, 26); transformMatrix = new ModMatrix(transformGrid10_2, 26); - assertEquals("ModMatrix 10x10 failed dot product ModMatrix.", 35750, matrix.dotProduct(transformMatrix)); + assertEquals(35750, matrix.dotProduct(transformMatrix)); } @Test @@ -1336,7 +1336,7 @@ public class TestModMatrix{ ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix transformMatrix = new ModMatrix(transformGrid1_2, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{2}}, 26); - assertEquals("ModMatrix 1x1 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Invalid hadamard products ModMatrix testMatrix = new ModMatrix(grid1, 26); @@ -1356,7 +1356,7 @@ public class TestModMatrix{ {2, 6}, {2, 6} }, 26); - assertEquals("ModMatrix 2x2 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //Integer matrix IntegerMatrix transformMatrix2 = new IntegerMatrix(transformGrid2_2); assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix2)); @@ -1369,7 +1369,7 @@ public class TestModMatrix{ {2, 6, 12}, {2, 6, 12} }, 26); - assertEquals("ModMatrix 3x3 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //4x4 matrix = new ModMatrix(grid4, 26); @@ -1380,7 +1380,7 @@ public class TestModMatrix{ {2, 6, 12, 20}, {2, 6, 12, 20} }, 26); - assertEquals("ModMatrix 4x4 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -1397,7 +1397,7 @@ public class TestModMatrix{ {2, 6, 12, 20, 30, 42, 56, 72, 90, 110}, {2, 6, 12, 20, 30, 42, 56, 72, 90, 110} }, 26); - assertEquals("ModMatrix 10x10 failed hadamard product.", correctMatrix, matrix.hadamardProduct(transformMatrix)); + assertEquals(correctMatrix, matrix.hadamardProduct(transformMatrix)); } @Test @@ -1405,7 +1405,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1}}, 26); - assertEquals("ModMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //2x2 matrix = new ModMatrix(grid2, 26); @@ -1413,7 +1413,7 @@ public class TestModMatrix{ {1, 1}, {2, 2} }, 26); - assertEquals("ModMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //3x3 matrix = new ModMatrix(grid3, 26); @@ -1422,7 +1422,7 @@ public class TestModMatrix{ {2, 2, 2}, {3, 3, 3} }, 26); - assertEquals("ModMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //4x4 matrix = new ModMatrix(grid4, 26); @@ -1432,7 +1432,7 @@ public class TestModMatrix{ {3, 3, 3, 3}, {4, 4, 4, 4} }, 26); - assertEquals("ModMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); //10x10 matrix = new ModMatrix(grid10, 26); @@ -1448,14 +1448,14 @@ public class TestModMatrix{ {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, }, 26); - assertEquals("ModMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose()); + assertEquals(correctMatrix, matrix.transpose()); } @Test public void testDeterminant(){ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); - assertEquals("ModMatrix 1x1 failed determinant.", 1, matrix.determinant()); + assertEquals(1, matrix.determinant()); //Invalid determinants ModMatrix testMatrix = new ModMatrix(new int[][]{{0, 0}}, 26); @@ -1465,39 +1465,39 @@ public class TestModMatrix{ //2x2 matrix = new ModMatrix(grid2, 26); - assertEquals("ModMatrix 2x2 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new ModMatrix(new int[][]{ {1, 4}, {4, 1} }, 26); - assertEquals("ModMatrix 2x2 failed determinant2.", -15, matrix.determinant()); + assertEquals(-15, matrix.determinant()); //det assertEquals(matrix.determinant(), matrix.det()); //3x3 matrix = new ModMatrix(grid3, 26); - assertEquals("ModMatrix 3x3 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new ModMatrix(new int[][]{ {1, 4, 2}, {2, 4, 1}, {4, 1, 2} }, 26); - assertEquals("ModMatrix 3x3 failed determinant2.", -21, matrix.determinant()); + assertEquals(-21, matrix.determinant()); //4x4 matrix = new ModMatrix(grid4, 26); - assertEquals("ModMatrix 4x4 failed determiant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new ModMatrix(new int[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3} }, 26); - assertEquals("ModMatrix 4x4 failed determinant2.", 160, matrix.determinant()); + assertEquals(160, matrix.determinant()); //10x10 matrix = new ModMatrix(grid10, 26); - assertEquals("ModMatrix 10x10 failed determinant1.", 0, matrix.determinant()); + assertEquals(0, matrix.determinant()); matrix = new ModMatrix(new int[][]{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {2, 3, 4, 5, 6, 7, 8, 9, 10, 1}, @@ -1510,7 +1510,7 @@ public class TestModMatrix{ {9, 10, 1, 2, 3, 4, 5, 6, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1} }, 26); - assertEquals("ModMatrix 10x10 failed determinant2.", -10000000, matrix.determinant()); + assertEquals(-10000000, matrix.determinant()); } @Test @@ -1518,7 +1518,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(grid1, 26); - assertEquals("ModMatrix 1x1 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //Invalid cofactor ModMatrix testMatrix = new ModMatrix(new int[][]{{0, 0}}, 26); @@ -1532,14 +1532,14 @@ public class TestModMatrix{ {2, -1}, {-2, 1} }, 26); - assertEquals("ModMatrix 2x2 failed cofactor.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //cof assertEquals(matrix.cofactor(), matrix.cof()); //3x3 matrix = new ModMatrix(grid3, 26); correctMatrix = new ModMatrix(3, 3, 0, 26); - assertEquals("ModMatrix 3x3 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new ModMatrix(new int[][]{ {1, 4, 2}, {2, 4, 1}, @@ -1550,12 +1550,12 @@ public class TestModMatrix{ {-6, -6, 15}, {-4, 3, -4} }, 26); - assertEquals("ModMatrix 3x3 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //4x4 matrix = new ModMatrix(grid4, 26); correctMatrix = new ModMatrix(4, 4, 0, 26); - assertEquals("ModMatrix 4x4 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); matrix = new ModMatrix(new int[][]{ {1, 2, 3, 4}, {2, 3, 4, 1}, @@ -1568,14 +1568,14 @@ public class TestModMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }, 26); - assertEquals("ModMatrix 4x4 failed cofactor2.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new ModMatrix(grid10); correctMatrix = new ModMatrix(10, 10, 0); - assertEquals("ModMatrix 10x10 failed cofactor1.", correctMatrix, matrix.cofactor()); + assertEquals(correctMatrix, matrix.cofactor()); */ } @@ -1584,7 +1584,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(new int[][]{{1}}, 26); - assertEquals("ModMatrix 1x1 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //Invalid powers final ModMatrix testMatrix = new ModMatrix(new int[][]{{0}, {0}}, 26); @@ -1602,7 +1602,7 @@ public class TestModMatrix{ {9, 18}, {9, 18} }, 26); - assertEquals("ModMatrix 2x2 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //3x3 matrix = new ModMatrix(grid3, 26); @@ -1611,7 +1611,7 @@ public class TestModMatrix{ {36, 72, 108}, {36, 72, 108} }, 26); - assertEquals("ModMatrix 3x3 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //4x4 //0 @@ -1622,7 +1622,7 @@ public class TestModMatrix{ {1, 1, 1, 1}, {1, 1, 1, 1} }, 26); - assertEquals("ModMatrix 4x4 failed power 0.", correctMatrix, matrix.pow(0)); + assertEquals(correctMatrix, matrix.pow(0)); //1 correctMatrix = new ModMatrix(new int[][]{ {1, 2, 3, 4}, @@ -1630,7 +1630,7 @@ public class TestModMatrix{ {1, 2, 3, 4}, {1, 2, 3, 4} }, 26); - assertEquals("ModMatrix 4x4 failed power 1.", correctMatrix, matrix.pow(1)); + assertEquals(correctMatrix, matrix.pow(1)); //3 correctMatrix = new ModMatrix(new int[][]{ {100, 200, 300, 400}, @@ -1638,7 +1638,7 @@ public class TestModMatrix{ {100, 200, 300, 400}, {100, 200, 300, 400} }, 26); - assertEquals("ModMatrix 4x4 failed power 3.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); //10x10 matrix = new ModMatrix(grid10, 26); @@ -1654,7 +1654,7 @@ public class TestModMatrix{ {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250}, {3025, 6050, 9075, 12100, 15125, 18150, 21175, 24200, 27225, 30250} }, 26); - assertEquals("ModMatrix 10x10 failed power.", correctMatrix, matrix.pow(3)); + assertEquals(correctMatrix, matrix.pow(3)); } @Test @@ -1662,7 +1662,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(grid1, 26); - assertEquals("ModMatrix 1x1 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //2x2 matrix = new ModMatrix(grid2, 26); @@ -1670,14 +1670,14 @@ public class TestModMatrix{ {2, -2}, {-1, 1} }, 26); - assertEquals("ModMatrix 2x2 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //adj assertEquals(matrix.adjoint(), matrix.adj()); //3x3 matrix = new ModMatrix(grid3, 26); correctMatrix = new ModMatrix(3, 3, 0, 26); - assertEquals("ModMatrix 3x3 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //4x4 matrix = new ModMatrix(new int[][]{ @@ -1692,14 +1692,14 @@ public class TestModMatrix{ {4, 44, -36, 4}, {44, -36, 4, 4} }, 26); - assertEquals("ModMatrix 4x4 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); //10x10 //?Skipping 10x10 test because test took > 5s by itself /* matrix = new ModMatrix(grid10); correctMatrix = new ModMatrix(10, 10, 0); - assertEquals("ModMatrix 10x10 failed adjoint.", correctMatrix, matrix.adjoint()); + assertEquals(correctMatrix, matrix.adjoint()); */ } @@ -1708,7 +1708,7 @@ public class TestModMatrix{ //1x1 ModMatrix matrix = new ModMatrix(grid1, 26); ModMatrix correctMatrix = new ModMatrix(grid1, 26); - assertEquals("ModMatrix 1x1 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //Invalid inverse ModMatrix testMatrix = new ModMatrix(new int[][]{{0, 0}}, 26); @@ -1740,7 +1740,7 @@ public class TestModMatrix{ {19, 2}, {2, 19} }, 26); - assertEquals("ModMatrix 2x2 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //3x3 matrix = new ModMatrix(new int[][]{ @@ -1753,7 +1753,7 @@ public class TestModMatrix{ { 0, 4, 11}, {18, 3, 20} }, 26); - assertEquals("ModMatrix 3x3 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //4x4 matrix = new ModMatrix(new int[][]{ @@ -1768,7 +1768,7 @@ public class TestModMatrix{ { 9, 6, 22, 13}, {19, 7, 22, 5} }, 26); - assertEquals("ModMatrix 4x4 failed inverse.", correctMatrix, matrix.inverse()); + assertEquals(correctMatrix, matrix.inverse()); //10x10 //?Skipped 10x10 because it would take a long time to compute diff --git a/version-rules.xml b/version-rules.xml new file mode 100644 index 0000000..7ab49c9 --- /dev/null +++ b/version-rules.xml @@ -0,0 +1,17 @@ + + + + + (?i).*Alpha(?:-?\d+)? + (?i).*a(?:-?\d+)? + (?i).*Beta(?:-?\d+)? + (?i).*-B(?:-?\d+)? + (?i).*RC(?:-?\d+)? + (?i).*CR(?:-?\d+)? + (?i).*M(?:-?\d+)? + + + +