public void SumExtensionMethod_ComputeSumOfTwoSymetricMatrices() { int[][] testArray = { new[] { 1, 3, 0 }, new[] { 3, 2, 6 }, new[] { 0, 6, 5 } }; var matrix = new SymmetricMatrix <int>(testArray); var other = new SymmetricMatrix <int>(testArray); var actualResult = matrix.Sum(other); int[][] expectedArray = { new[] { 2, 6, 0 }, new[] { 6, 4, 12 }, new[] { 0, 12, 10 } }; var expectedResult = new SquareMatrix <int>(expectedArray); for (int i = 0; i < matrix.Size; i++) { for (int j = 0; j < matrix.Size; j++) { Assert.AreEqual(expectedResult[i, j], actualResult[i, j]); } } }
public void Sum() { var matrix = new SymmetricMatrix <int>(1, 2, 3, 2, 4, 5, 3, 5, 6); var actual = matrix.Sum(matrix); foreach (var variable in actual) { Console.WriteLine(variable); } }
public void MatrixSumm_Test() { int[,] expectedResult = { { 10, 0, 8, 9 }, { 0, 2, 9, 4 }, { 8, 9, 4, 6 }, { 9, 4, 6, 6 } }; SymmetricMatrix <int> firstMatrix = new SymmetricMatrix <int>(symmetricMatrix); DiagonalMatrix <int> secondMatrix = new DiagonalMatrix <int>(diagonalMatrix); SquareMatrix <int> actualResult = firstMatrix.Sum <int>(secondMatrix); for (int i = 0; i < actualResult.Size; i++) { for (int j = 0; j < actualResult.Size; j++) { Assert.AreEqual(expectedResult[i, j], actualResult[i, j]); } } }