public void GeneralMatrixAdditionTest() { GeneralMatrix<int> matrix1 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); GeneralMatrix<int> matrix2 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); matrix1.SumWith(matrix2, AdditionMethod); Assert.AreEqual<int>(2, matrix1[0, 0]); Assert.AreEqual<int>(4, matrix1[0, 1]); Assert.AreEqual<int>(6, matrix1[0, 2]); Assert.AreEqual<int>(8, matrix1[0, 3]); Assert.AreEqual<int>(4, matrix1[1, 0]); Assert.AreEqual<int>(2, matrix1[1, 1]); Assert.AreEqual<int>(4, matrix1[1, 2]); Assert.AreEqual<int>(8, matrix1[1, 3]); Assert.AreEqual<int>(6, matrix1[2, 0]); Assert.AreEqual<int>(4, matrix1[2, 1]); Assert.AreEqual<int>(2, matrix1[2, 2]); Assert.AreEqual<int>(8, matrix1[2, 3]); }
public void MatricesAdditionCallingWithAdditionRuleTest() { GeneralMatrix<int> matrix1 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); GeneralMatrix<int> matrix2 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); matrix1.SumWith(matrix2, null); }
public void MatricesAdditionDifferentAddendsSizesTest() { GeneralMatrix<int> matrix1 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); GeneralMatrix<int> matrix2 = new GeneralMatrix<int>(new int[3, 3] { { 1, 2, 3 }, { 2, 1, 2 }, { 3, 2, 1 } }); matrix1.SumWith(matrix2, AdditionMethod); }
public void MatricesAdditionCallingWithNullSecondAddendTest() { GeneralMatrix<int> matrix1 = new GeneralMatrix<int>(new int[3, 4] { { 1, 2, 3, 4 }, { 2, 1, 2, 4 }, { 3, 2, 1, 4 } }); GeneralMatrix<int> matrix2 = null; matrix1.SumWith(matrix2, AdditionMethod); }