Fixed typoes

This commit is contained in:
2022-02-09 22:32:33 +00:00
parent d990d1b2af
commit f371dab2c7

View File

@@ -1,7 +1,7 @@
//Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java //Matrix/src/test/java/com/mattrixwv/matrix/TestIntegerMatrix.java
//Mattrixwv //Mattrixwv
// Created: 02-01-22 // Created: 02-01-22
//Modified: 02-08-22 //Modified: 02-09-22
package com.mattrixwv.matrix; package com.mattrixwv.matrix;
@@ -120,82 +120,82 @@ public class TestIntegerMatrix{
assertTrue("IntegerMatrix 1x1 failed equals IntegerMatrix.", matrix.equals(matrix)); assertTrue("IntegerMatrix 1x1 failed equals IntegerMatrix.", matrix.equals(matrix));
@SuppressWarnings("unlikely-arg-type") @SuppressWarnings("unlikely-arg-type")
boolean gridEquals = matrix.equals(grid1); boolean gridEquals = matrix.equals(grid1);
assertTrue("IntegerMatrix 1x1 failed equals int[][]", gridEquals); assertTrue("IntegerMatrix 1x1 failed equals int[][].", gridEquals);
//2x2 //2x2
matrix = new IntegerMatrix(grid2); matrix = new IntegerMatrix(grid2);
assertTrue("IntegerMatrix 2x2 failed equals IntegerMatrix.", matrix.equals(matrix)); assertTrue("IntegerMatrix 2x2 failed equals IntegerMatrix.", matrix.equals(matrix));
@SuppressWarnings("unlikely-arg-type") @SuppressWarnings("unlikely-arg-type")
boolean gridEquals2 = matrix.equals(grid2); boolean gridEquals2 = matrix.equals(grid2);
assertTrue("IntegerMatrix 2x2 failed equals int[][]", gridEquals2); assertTrue("IntegerMatrix 2x2 failed equals int[][].", gridEquals2);
//3x3 //3x3
matrix = new IntegerMatrix(grid3); matrix = new IntegerMatrix(grid3);
assertTrue("IntegerMatrix 3x3 failed equals IntegerMatrix.", matrix.equals(matrix)); assertTrue("IntegerMatrix 3x3 failed equals IntegerMatrix.", matrix.equals(matrix));
@SuppressWarnings("unlikely-arg-type") @SuppressWarnings("unlikely-arg-type")
boolean gridEquals3 = matrix.equals(grid3); boolean gridEquals3 = matrix.equals(grid3);
assertTrue("IntegerMatrix 3x3 failed equals int[][]", gridEquals3); assertTrue("IntegerMatrix 3x3 failed equals int[][].", gridEquals3);
//4x4 //4x4
matrix = new IntegerMatrix(grid4); matrix = new IntegerMatrix(grid4);
assertTrue("IntegerMatrix 4x4 failed equals IntegerMatrix.", matrix.equals(matrix)); assertTrue("IntegerMatrix 4x4 failed equals IntegerMatrix.", matrix.equals(matrix));
@SuppressWarnings("unlikely-arg-type") @SuppressWarnings("unlikely-arg-type")
boolean gridEquals4 = matrix.equals(grid4); boolean gridEquals4 = matrix.equals(grid4);
assertTrue("IntegerMatrix 4x4 failed equals int[][]", gridEquals4); assertTrue("IntegerMatrix 4x4 failed equals int[][].", gridEquals4);
//10x10 //10x10
matrix = new IntegerMatrix(grid10); matrix = new IntegerMatrix(grid10);
assertTrue("IntegerMatrix = 10x10 failed equals IntegerMatrix.", matrix.equals(matrix)); assertTrue("IntegerMatrix = 10x10 failed equals IntegerMatrix.", matrix.equals(matrix));
@SuppressWarnings("unlikely-arg-type") @SuppressWarnings("unlikely-arg-type")
boolean gridEquals10 = matrix.equals(grid10); boolean gridEquals10 = matrix.equals(grid10);
assertTrue("IntegerMatrix 10x10 failed equals int[][]", gridEquals10); assertTrue("IntegerMatrix 10x10 failed equals int[][].", gridEquals10);
} }
@Test @Test
public void testGets(){ public void testGets(){
//1x1 //1x1
IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix matrix = new IntegerMatrix(grid1);
assertEquals("IntegerMatrix 1x1 failed get", 1, matrix.get(0, 0)); assertEquals("IntegerMatrix 1x1 failed get.", 1, matrix.get(0, 0));
//GetRow //GetRow
IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}});
assertEquals("IntegerMatrix 1x1 failed getRow", correctMatrix, matrix.getRow(0)); assertEquals("IntegerMatrix 1x1 failed getRow.", correctMatrix, matrix.getRow(0));
//GetColumn //GetColumn
correctMatrix = new IntegerMatrix(new int[][]{{1}}); correctMatrix = new IntegerMatrix(new int[][]{{1}});
assertEquals("IntegerMatrix 1x1 failed getColumn", correctMatrix, matrix.getCol(0)); assertEquals("IntegerMatrix 1x1 failed getCol.", correctMatrix, matrix.getCol(0));
//2x2 //2x2
matrix = new IntegerMatrix(grid2); matrix = new IntegerMatrix(grid2);
assertEquals("IntegerMatrix 2x2 failed get", 1, matrix.get(0, 0)); assertEquals("IntegerMatrix 2x2 failed get.", 1, matrix.get(0, 0));
//GetRow //GetRow
correctMatrix = new IntegerMatrix(new int[][]{{1, 2}}); correctMatrix = new IntegerMatrix(new int[][]{{1, 2}});
assertEquals("IntegerMatrix 2x2 failed getRow", correctMatrix, matrix.getRow(0)); assertEquals("IntegerMatrix 2x2 failed getRow.", correctMatrix, matrix.getRow(0));
//GetColumn //GetColumn
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1}, {1},
{1} {1}
}); });
assertEquals("IntegerMatrix 2x2 failed getColumns", correctMatrix, matrix.getCol(0)); assertEquals("IntegerMatrix 2x2 failed getCol.", correctMatrix, matrix.getCol(0));
//3x3 //3x3
matrix = new IntegerMatrix(grid3); matrix = new IntegerMatrix(grid3);
assertEquals("IntegerMatrix 3x3 failed get", 1, matrix.get(0, 0)); assertEquals("IntegerMatrix 3x3 failed get.", 1, matrix.get(0, 0));
//GetRow //GetRow
correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3}}); correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3}});
assertEquals("IntegerMatrix 3x3 failed getRow", correctMatrix, matrix.getRow(0)); assertEquals("IntegerMatrix 3x3 failed getRow.", correctMatrix, matrix.getRow(0));
//GetColumn //GetColumn
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1}, {1},
{1}, {1},
{1} {1}
}); });
assertEquals("IntegerMatrix 3x3 failed getCol", correctMatrix, matrix.getCol(0)); assertEquals("IntegerMatrix 3x3 failed getCol.", correctMatrix, matrix.getCol(0));
//4x4 //4x4
matrix = new IntegerMatrix(grid4); matrix = new IntegerMatrix(grid4);
assertEquals("IntegerMatrix 4x4 failed get", 1, matrix.get(0, 0)); assertEquals("IntegerMatrix 4x4 failed get.", 1, matrix.get(0, 0));
//GetRow //GetRow
correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3, 4}}); correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3, 4}});
assertEquals("IntegerMatrix 4x4 failed getRow", correctMatrix, matrix.getRow(0)); assertEquals("IntegerMatrix 4x4 failed getRow.", correctMatrix, matrix.getRow(0));
//GetColumn //GetColumn
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1}, {1},
@@ -203,14 +203,14 @@ public class TestIntegerMatrix{
{1}, {1},
{1} {1}
}); });
assertEquals("IntegerMatrix 4x4 failed getCol", correctMatrix, matrix.getCol(0)); assertEquals("IntegerMatrix 4x4 failed getCol.", correctMatrix, matrix.getCol(0));
//10x10 //10x10
matrix = new IntegerMatrix(grid10); matrix = new IntegerMatrix(grid10);
assertEquals("IntegerMatrix 10x10 failed get", 1, matrix.get(0, 0)); assertEquals("IntegerMatrix 10x10 failed get.", 1, matrix.get(0, 0));
//GetRow //GetRow
correctMatrix = new IntegerMatrix(new int[][]{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}); 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("IntegerMatrix 10x10 failed getRow.", correctMatrix, matrix.getRow(0));
//GetColumn //GetColumn
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1}, {1},
@@ -224,7 +224,7 @@ public class TestIntegerMatrix{
{1}, {1},
{1} {1}
}); });
assertEquals("IntegerMatrix 10x10 failed getColumn", correctMatrix, matrix.getCol(0)); assertEquals("IntegerMatrix 10x10 failed getColumn.", correctMatrix, matrix.getCol(0));
} }
@Test @Test
@@ -234,15 +234,15 @@ public class TestIntegerMatrix{
IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix matrix = new IntegerMatrix(grid1);
matrix.set(0, 0, 2); matrix.set(0, 0, 2);
IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{2}}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{2}});
assertEquals("IntegerMatrix 1x1 failed set", correctMatrix, matrix); assertEquals("IntegerMatrix 1x1 failed set.", correctMatrix, matrix);
//SetRow //SetRow
matrix.setRow(0, new int[]{0}); matrix.setRow(0, new int[]{0});
correctMatrix = new IntegerMatrix(new int[][]{{0}}); correctMatrix = new IntegerMatrix(new int[][]{{0}});
assertEquals("IntegerMatrix 1x1 failed setRow", correctMatrix, matrix); assertEquals("IntegerMatrix 1x1 failed setRow.", correctMatrix, matrix);
//SetColumn //SetColumn
matrix.setCol(0, new int[]{1}); matrix.setCol(0, new int[]{1});
correctMatrix = new IntegerMatrix(new int[][]{{1}}); correctMatrix = new IntegerMatrix(new int[][]{{1}});
assertEquals("IntegerMatrix 1x1 failed setCol", correctMatrix, matrix); assertEquals("IntegerMatrix 1x1 failed setCol.", correctMatrix, matrix);
//2x2 //2x2
//Set //Set
@@ -252,14 +252,14 @@ public class TestIntegerMatrix{
{3, 2}, {3, 2},
{1, 2} {1, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed set", correctMatrix, matrix); assertEquals("IntegerMatrix 2x2 failed set.", correctMatrix, matrix);
//SetRow //SetRow
matrix.setRow(1, new int[]{2, 1}); matrix.setRow(1, new int[]{2, 1});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{3, 2}, {3, 2},
{2, 1} {2, 1}
}); });
assertEquals("IntegerMatrix 2x2 failed set row", correctMatrix, matrix); assertEquals("IntegerMatrix 2x2 failed set row.", correctMatrix, matrix);
//SetColumn //SetColumn
matrix = new IntegerMatrix(grid2); matrix = new IntegerMatrix(grid2);
matrix.setCol(0, new int[]{3, 3}); matrix.setCol(0, new int[]{3, 3});
@@ -267,7 +267,7 @@ public class TestIntegerMatrix{
{3, 2}, {3, 2},
{3, 2} {3, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed set row", correctMatrix, matrix); assertEquals("IntegerMatrix 2x2 failed set row.", correctMatrix, matrix);
//3x3 //3x3
//Set //Set
@@ -278,7 +278,7 @@ public class TestIntegerMatrix{
{1, 2, 3}, {1, 2, 3},
{1, 2, 3}, {1, 2, 3},
}); });
assertEquals("IntegerMatrix 3x3 failed set", correctMatrix, matrix); assertEquals("IntegerMatrix 3x3 failed set.", correctMatrix, matrix);
//SetRow //SetRow
matrix.setRow(0, new int[]{0, 1, 2}); matrix.setRow(0, new int[]{0, 1, 2});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -286,7 +286,7 @@ public class TestIntegerMatrix{
{1, 2, 3}, {1, 2, 3},
{1, 2, 3} {1, 2, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed setRow", correctMatrix, matrix); assertEquals("IntegerMatrix 3x3 failed setRow.", correctMatrix, matrix);
//SetColumn //SetColumn
matrix.setCol(0, new int[]{0, 0, 0}); matrix.setCol(0, new int[]{0, 0, 0});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -294,7 +294,7 @@ public class TestIntegerMatrix{
{0, 2, 3}, {0, 2, 3},
{0, 2, 3} {0, 2, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed setColumn", correctMatrix, matrix); assertEquals("IntegerMatrix 3x3 failed setColumn.", correctMatrix, matrix);
//4x4 //4x4
//Set //Set
@@ -306,7 +306,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4}, {1, 2, 3, 4},
{1, 2, 3, 4} {1, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed set", correctMatrix, matrix); assertEquals("IntegerMatrix 4x4 failed set.", correctMatrix, matrix);
//SetRow //SetRow
matrix.setRow(0, new int[]{4, 3, 2, 1}); matrix.setRow(0, new int[]{4, 3, 2, 1});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -315,7 +315,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4}, {1, 2, 3, 4},
{1, 2, 3, 4} {1, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed setRow", correctMatrix, matrix); assertEquals("IntegerMatrix 4x4 failed setRow.", correctMatrix, matrix);
//SetColumn //SetColumn
matrix.setCol(0, new int[]{0, 0, 0, 0}); matrix.setCol(0, new int[]{0, 0, 0, 0});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -324,7 +324,7 @@ public class TestIntegerMatrix{
{0, 2, 3, 4}, {0, 2, 3, 4},
{0, 2, 3, 4} {0, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed setCol", correctMatrix, matrix); assertEquals("IntegerMatrix 4x4 failed setCol.", correctMatrix, matrix);
//10x10 //10x10
//Set //Set
@@ -342,7 +342,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 set", correctMatrix, matrix); assertEquals("IntegerMatrix 10x10 failed setRow.", correctMatrix, matrix);
//SetRow //SetRow
matrix.setRow(0, new int[]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}); matrix.setRow(0, new int[]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -357,7 +357,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 setRow", correctMatrix, matrix); assertEquals("IntegerMatrix 10x10 failed setRow.", correctMatrix, matrix);
//SetColumn //SetColumn
matrix.setCol(0, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}); matrix.setCol(0, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -372,7 +372,7 @@ public class TestIntegerMatrix{
{0, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {0, 2, 3, 4, 5, 6, 7, 8, 9, 10},
{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("IntegerMatrix 10x10 failed setColumn.", correctMatrix, matrix);
} }
@Test @Test
@@ -382,12 +382,12 @@ public class TestIntegerMatrix{
IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix matrix = new IntegerMatrix(grid1);
matrix.addRow(new int[]{1}); matrix.addRow(new int[]{1});
IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}, {1}}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}, {1}});
assertEquals("IntegerMatrix 1x1 failed addRow", correctMatrix, matrix); assertEquals("IntegerMatrix 1x1 failed addRow.", correctMatrix, matrix);
//AddColumn //AddColumn
matrix = new IntegerMatrix(grid1); matrix = new IntegerMatrix(grid1);
matrix.addCol(new int[]{1}); matrix.addCol(new int[]{1});
correctMatrix = new IntegerMatrix(new int[][]{{1, 1}}); correctMatrix = new IntegerMatrix(new int[][]{{1, 1}});
assertEquals("IntegerMatrix 1x1 failed addCol", correctMatrix, matrix); assertEquals("IntegerMatrix 1x1 failed addCol.", correctMatrix, matrix);
//2x2 //2x2
//AddRow //AddRow
@@ -398,7 +398,7 @@ public class TestIntegerMatrix{
{1, 2}, {1, 2},
{1, 2} {1, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed addRow", correctMatrix, matrix); assertEquals("IntegerMatrix 2x2 failed addRow.", correctMatrix, matrix);
//AddColumn //AddColumn
matrix = new IntegerMatrix(grid2); matrix = new IntegerMatrix(grid2);
matrix.addCol(new int[]{3, 3}); matrix.addCol(new int[]{3, 3});
@@ -406,7 +406,7 @@ public class TestIntegerMatrix{
{1, 2, 3}, {1, 2, 3},
{1, 2, 3} {1, 2, 3}
}); });
assertEquals("IntegerMatrix 2x2 failed addCol", correctMatrix, matrix); assertEquals("IntegerMatrix 2x2 failed addCol.", correctMatrix, matrix);
//3x3 //3x3
//AddRow //AddRow
@@ -418,7 +418,7 @@ public class TestIntegerMatrix{
{1, 2, 3}, {1, 2, 3},
{1, 2, 3} {1, 2, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed addRow", correctMatrix, matrix); assertEquals("IntegerMatrix 3x3 failed addRow.", correctMatrix, matrix);
//AddColumn //AddColumn
matrix = new IntegerMatrix(grid3); matrix = new IntegerMatrix(grid3);
matrix.addCol(new int[]{4, 4, 4}); matrix.addCol(new int[]{4, 4, 4});
@@ -427,7 +427,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4}, {1, 2, 3, 4},
{1, 2, 3, 4} {1, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 3x3 failed addCol", correctMatrix, matrix); assertEquals("IntegerMatrix 3x3 failed addCol.", correctMatrix, matrix);
//4x4 //4x4
//AddRow //AddRow
@@ -440,7 +440,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4}, {1, 2, 3, 4},
{1, 2, 3, 4} {1, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed addRow", correctMatrix, matrix); assertEquals("IntegerMatrix 4x4 failed addRow.", correctMatrix, matrix);
//AddColumn //AddColumn
matrix.addCol(new int[]{5, 5, 5, 5, 5}); matrix.addCol(new int[]{5, 5, 5, 5, 5});
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
@@ -450,7 +450,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5},
{1, 2, 3, 4, 5} {1, 2, 3, 4, 5}
}); });
assertEquals("IntegerMatrix 4x4 failed addCol", correctMatrix, matrix); assertEquals("IntegerMatrix 4x4 failed addCol.", correctMatrix, matrix);
//10x10 //10x10
//AddRow //AddRow
@@ -469,7 +469,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 addRow", correctMatrix, matrix); assertEquals("IntegerMatrix 10x10 failed addRow.", correctMatrix, matrix);
//AddColumn //AddColumn
matrix = new IntegerMatrix(grid10); matrix = new IntegerMatrix(grid10);
matrix.addCol(new int[]{11, 11, 11, 11, 11, 11, 11, 11, 11, 11}); matrix.addCol(new int[]{11, 11, 11, 11, 11, 11, 11, 11, 11, 11});
@@ -485,7 +485,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},
{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("IntegerMatrix 10x10 failed addColumn.", correctMatrix, matrix);
} }
@Test @Test
@@ -495,13 +495,13 @@ public class TestIntegerMatrix{
IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix matrix = new IntegerMatrix(grid1);
IntegerMatrix secondMatrix = new IntegerMatrix(grid1); IntegerMatrix secondMatrix = new IntegerMatrix(grid1);
IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1, 1}}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1, 1}});
assertEquals("IntegerMatrix 1x1 failed appendRight", correctMatrix, matrix.appendRight(secondMatrix)); assertEquals("IntegerMatrix 1x1 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix));
//appendBottom //appendBottom
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1}, {1},
{1} {1}
}); });
assertEquals("IntegerMatrix 1x1 failed appendBottom", correctMatrix, matrix.appendBottom(secondMatrix)); assertEquals("IntegerMatrix 1x1 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix));
//2x2 //2x2
//appendRight //appendRight
@@ -511,7 +511,7 @@ public class TestIntegerMatrix{
{1, 2, 1, 2}, {1, 2, 1, 2},
{1, 2, 1, 2} {1, 2, 1, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed appendRight", correctMatrix, matrix.appendRight(secondMatrix)); assertEquals("IntegerMatrix 2x2 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix));
//appendBottom //appendBottom
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1, 2}, {1, 2},
@@ -519,7 +519,7 @@ public class TestIntegerMatrix{
{1, 2}, {1, 2},
{1, 2} {1, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed appendBottom", correctMatrix, matrix.appendBottom(secondMatrix)); assertEquals("IntegerMatrix 2x2 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix));
//3x3 //3x3
//appendRight //appendRight
@@ -530,7 +530,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 1, 2, 3}, {1, 2, 3, 1, 2, 3},
{1, 2, 3, 1, 2, 3} {1, 2, 3, 1, 2, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed appendRight", correctMatrix, matrix.appendRight(secondMatrix)); assertEquals("IntegerMatrix 3x3 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix));
//appendBottom //appendBottom
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1, 2, 3}, {1, 2, 3},
@@ -540,7 +540,7 @@ public class TestIntegerMatrix{
{1, 2, 3}, {1, 2, 3},
{1, 2, 3} {1, 2, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed appendBottom", correctMatrix, matrix.appendBottom(secondMatrix)); assertEquals("IntegerMatrix 3x3 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix));
//4x4 //4x4
//appendRight //appendRight
@@ -552,7 +552,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4, 1, 2, 3, 4}, {1, 2, 3, 4, 1, 2, 3, 4},
{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("IntegerMatrix 4x4 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix));
//appendBottom //appendBottom
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{1, 2, 3, 4}, {1, 2, 3, 4},
@@ -564,7 +564,7 @@ public class TestIntegerMatrix{
{1, 2, 3, 4}, {1, 2, 3, 4},
{1, 2, 3, 4} {1, 2, 3, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed appendBottom", correctMatrix, matrix.appendBottom(secondMatrix)); assertEquals("IntegerMatrix 4x4 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix));
//10x10 //10x10
//appendRight //appendRight
@@ -582,7 +582,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},
{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("IntegerMatrix 10x10 failed appendRight.", correctMatrix, matrix.appendRight(secondMatrix));
//appendBottom //appendBottom
correctMatrix = new IntegerMatrix(new int[][]{ correctMatrix = new IntegerMatrix(new int[][]{
{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},
@@ -596,7 +596,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},
{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("IntegerMatrix 10x10 failed appendBottom.", correctMatrix, matrix.appendBottom(secondMatrix));
} }
@Test @Test
@@ -989,7 +989,7 @@ public class TestIntegerMatrix{
//1x1 //1x1
IntegerMatrix matrix = new IntegerMatrix(grid1); IntegerMatrix matrix = new IntegerMatrix(grid1);
IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}}); IntegerMatrix correctMatrix = new IntegerMatrix(new int[][]{{1}});
assertEquals("IntegerMatrix 1x1 failed transpose", correctMatrix, matrix.transpose()); assertEquals("IntegerMatrix 1x1 failed transpose.", correctMatrix, matrix.transpose());
//2x2 //2x2
matrix = new IntegerMatrix(grid2); matrix = new IntegerMatrix(grid2);
@@ -997,7 +997,7 @@ public class TestIntegerMatrix{
{1, 1}, {1, 1},
{2, 2} {2, 2}
}); });
assertEquals("IntegerMatrix 2x2 failed transpose", correctMatrix, matrix.transpose()); assertEquals("IntegerMatrix 2x2 failed transpose.", correctMatrix, matrix.transpose());
//3x3 //3x3
matrix = new IntegerMatrix(grid3); matrix = new IntegerMatrix(grid3);
@@ -1006,7 +1006,7 @@ public class TestIntegerMatrix{
{2, 2, 2}, {2, 2, 2},
{3, 3, 3} {3, 3, 3}
}); });
assertEquals("IntegerMatrix 3x3 failed transpose", correctMatrix, matrix.transpose()); assertEquals("IntegerMatrix 3x3 failed transpose.", correctMatrix, matrix.transpose());
//4x4 //4x4
matrix = new IntegerMatrix(grid4); matrix = new IntegerMatrix(grid4);
@@ -1016,7 +1016,7 @@ public class TestIntegerMatrix{
{3, 3, 3, 3}, {3, 3, 3, 3},
{4, 4, 4, 4} {4, 4, 4, 4}
}); });
assertEquals("IntegerMatrix 4x4 failed transpose", correctMatrix, matrix.transpose()); assertEquals("IntegerMatrix 4x4 failed transpose.", correctMatrix, matrix.transpose());
//10x10 //10x10
matrix = new IntegerMatrix(grid10); matrix = new IntegerMatrix(grid10);
@@ -1032,7 +1032,7 @@ public class TestIntegerMatrix{
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
}); });
assertEquals("IntegerMatrix 10x10 failed transpose", correctMatrix, matrix.transpose()); assertEquals("IntegerMatrix 10x10 failed transpose.", correctMatrix, matrix.transpose());
} }
@Test @Test