public void Matrix_Add_SquareMatrix() { var array = new[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var arrayExpected = new[, ] { { 2, 4, 6 }, { 8, 10, 12 }, { 14, 16, 18 } }; Matrix <int> lhs = new SquareMatrix <int>(array); var result = lhs.Add(lhs); Matrix <int> expected = new SquareMatrix <int>(arrayExpected); CollectionAssert.AreEqual(expected, result); array = new[, ] { { 1, 0, 0 }, { 0, 5, 0 }, { 0, 0, 9 } }; arrayExpected = new[, ] { { 2, 0, 0 }, { 0, 10, 0 }, { 0, 0, 18 } }; lhs = new SquareMatrix <int>(array); Matrix <int> rhs = new DiagonaleMatrix <int>(array); result = lhs.Add(rhs); expected = new SquareMatrix <int>(arrayExpected); CollectionAssert.AreEqual(expected, result); rhs = new SymmetricMatrix <int>(array); result = lhs.Add(rhs); CollectionAssert.AreEqual(expected, result); }
public void TestAddInt() { int[,] m = { {1, 0, 2, 3}, {2, 0, 3, 4}, {3, 0, 4, 5}, {4, 0, 5, 6} }; int[] m2 = { 0, 3, 4, 4}; SquareMatrix<int> matr1 = new SquareMatrix<int>(m); matr1.Add(new DiagonalMatrix<int>(m2)); int[,] rezult = { {1, 0, 2, 3}, {2, 3, 3, 4}, {3, 0, 8, 5}, {4, 0, 5, 10} }; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) Assert.AreEqual(matr1[i, j], rezult[i, j]); }
public void SummTest1() { int[][] diagonalMatrixInts = { new int[3] { 1, 0, 0 }, new int[3] { 0, 5, 0 }, new int[3] { 0, 0, 9 }, }; int[][] rs = { new int[3] { 2, 0, 0 }, new int[3] { 0, 10, 0 }, new int[3] { 0, 0, 18 }, }; SquareMatrix <int> mas1 = new SquareMatrix <int>(diagonalMatrixInts); SquareMatrix <int> mas2 = new SquareMatrix <int>(diagonalMatrixInts); SquareMatrix <int> mas3 = new SquareMatrix <int>(diagonalMatrixInts.Length); mas3 = (SquareMatrix <int>)mas1.Add(mas2); Assert.IsTrue(mas3.CompareToJaggedArray(rs)); }
public void Add_SquareMatrixAndSymmetricMatrix_CorrectResult(int order, int[] squareValues, int[] SymmetricValues) { var squareMatrix = new SquareMatrix <int>(order); squareMatrix.Copy(squareValues); var symmetricValues = new SymmetricMatrix <int>(order); symmetricValues.Copy(SymmetricValues); int[] values = new int[symmetricValues.Lenght]; int i = 0; foreach (var element in symmetricValues) { values[i++] = element; } var actual = squareMatrix.Add(symmetricValues); i = 0; foreach (var element in actual) { Assert.AreEqual(squareValues[i] + values[i], element); i++; } }
public void ValidationTest_DifferentSizes_InvalidOperationException() { var matrix1 = new SquareMatrix <int>(2); var matrix2 = new SquareMatrix <int>(3); Assert.Throws <InvalidOperationException>(() => matrix1.Add(matrix2)); }
public void SumMatrix_DifferentSizes_ThrownException() { SquareMatrix <int> matrix1 = new SquareMatrix <int>(1); SymmetricMatrix <int> matrix2 = new SymmetricMatrix <int>(2); Assert.Throws <ArgumentException>(() => matrix1.Add <int>(matrix2)); }
public void Add_SquareAndSymmetrical_ReturnSquareMatrix() { var matrix = new int[, ] { { 1, 2 }, { 4, 5 } }; var square = new SquareMatrix <int>(matrix); int[,] symmetrical = new int[, ] { { 1, 5 }, { 5, 7 } }; var diagonalMatrix = new SymmetricalMatrix <int>(symmetrical); var result = square.Add(diagonalMatrix); int[,] expectedValues = { { 2, 7 }, { 9, 12 } }; for (int i = 0; i < result.Size; i++) { for (int j = 0; j < result.Size; j++) { Assert.AreEqual(expectedValues[i, j], result[i, j]); } } }
public void Add_SquareAndDiagonal_ReturnSquareMatrix() { var matrix = new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var square = new SquareMatrix <int>(matrix); int[,] diagonal = new int[, ] { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; var diagonalMatrix = new DiagonalMatrix <int>(diagonal); var result = square.Add(diagonalMatrix); int[,] expectedValues = { { 2, 2, 3 }, { 4, 6, 6 }, { 7, 8, 10 } }; for (int i = 0; i < result.Size; i++) { for (int j = 0; j < result.Size; j++) { Assert.AreEqual(expectedValues[i, j], result[i, j]); } } }
public void MatrixAdd_Square_Matrix() { int[,] matrixIn1 = { { 1, 3, 5, 7 }, { 3, 5, 7, 9 }, { 5, 7, 9, 11 }, { 7, 9, 11, 13 } }; int[,] matrixIn2 = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; var matrix1 = new SquareMatrix <int>(matrixIn1); var matrix2 = new SquareMatrix <int>(matrixIn2); Func <int, int, int> addFunc = (x1, x2) => x1 + x2; var sumMatrix = matrix1.Add(matrix2, addFunc); for (int i = 0; i < sumMatrix.Size; i++) { for (int j = 0; j < sumMatrix.Size; j++) { Assert.AreEqual(sumMatrix[i, j], matrix1[i, j]); } } }
public void ValidationTest_SquarePlusSymmetric_InvalidOperationException() { var matrix1 = new SquareMatrix <int>(2); var matrix2 = new SymmetricMatrix <int>(3); Assert.Throws <InvalidOperationException>(() => matrix1.Add(matrix2)); }
public void Add_SquareMatrixAndDiagonalMatrix_CorrectResult(int order, int[] squareValues, int[] diagonalValues) { var squareMatrix = new SquareMatrix <int>(order); squareMatrix.Copy(squareValues); var diagonalMatrix = new DiagonalMatrix <int>(order); diagonalMatrix.Copy(diagonalValues); int[] values = new int[diagonalMatrix.Lenght]; int i = 0; foreach (var element in diagonalMatrix) { values[i++] = element; } var actual = squareMatrix.Add(diagonalMatrix); i = 0; foreach (var element in actual) { Assert.AreEqual(squareValues[i] + values[i], element); i++; } }
public void MatrixFailTests() { SquareMatrix <int> matrixInt = new SquareMatrix <int>(new int[1, 1] { { 1 } }); Assert.Throws <InvalidOperationException>(() => matrixInt.Add(squareMatrix)); }
public void AddingSquareMatrix() { Matrix<int> m = new SquareMatrix<int>(new int[2][] { new int[2] { 1, 2 }, new int[2] { 2, 3 } }); Matrix<int> m1 = new SquareMatrix<int>(new int[2][] { new int[2] { 1, 2 }, new int[2] { 2, 3 } }); Matrix<int> m2 = m.Add(m1); Matrix<int> m3 = new SquareMatrix<int>(new int[2][] { new int[2] { 2, 4 }, new int[2] { 4, 6 } }); Assert.IsTrue(m2.Equals(m3)); }
public void Add_Square_Tests() { SquareMatrix <int> lhs = new SquareMatrix <int>(sq); SquareMatrix <int> rhs1 = new SquareMatrix <int>(diag); DiagonalMatrix <int> rhs2 = new DiagonalMatrix <int>(diag); SymmetricMatrix <int> rhs3 = new SymmetricMatrix <int>(diag); int[,] expected = new int[, ] { { 2, 2, 3 }, { 4, 6, 6 }, { 7, 8, 10 } }; CollectionAssert.AreEqual(new SquareMatrix <int>(expected), lhs.Add(rhs1)); CollectionAssert.AreEqual(new SquareMatrix <int>(expected), lhs.Add(rhs2)); CollectionAssert.AreEqual(new SquareMatrix <int>(expected), lhs.Add(rhs3)); }
public int[,] AddSquareAndDiagonalTestInt(int[,] elements) { var lhs = new SquareMatrix <int>(elements); var rhs = new DiagonalMatrix <int>(elements); lhs = lhs.Add(rhs) as SquareMatrix <int>; return(lhs?.ToArray()); }
public void Add_MatricesTypeWithOperatorPlus_DoubleSourceArray() { TypeWithOperatorPlus[,] sourceArray = new TypeWithOperatorPlus[,] { {new TypeWithOperatorPlus(1), new TypeWithOperatorPlus(2)}, {new TypeWithOperatorPlus(3), new TypeWithOperatorPlus(4)}, }; SquareMatrix<TypeWithOperatorPlus> lhs = new SquareMatrix<TypeWithOperatorPlus>(sourceArray); SquareMatrix<TypeWithOperatorPlus> rhs = new SquareMatrix<TypeWithOperatorPlus>(sourceArray); lhs.Add(rhs); TypeWithOperatorPlus[,] actual = lhs.Add(rhs).ToArray(); bool areDouble = true; for (int i = 0; i < sourceArray.GetLength(0); i++) for (int j = 0; j < sourceArray.GetLength(1); j++) areDouble &= (sourceArray[i, j].Number * 2) == actual[i, j].Number; Assert.IsTrue(areDouble); }
public string[,] AddTestString(string[,] elements) { var lhs = new SquareMatrix <string>(elements); var rhs = new SquareMatrix <string>(elements); lhs = lhs.Add(rhs) as SquareMatrix <string>; return(lhs?.ToArray()); }
public void SquareMatrix_Add_SquareMatrix_Expected_RuntimeBinderException() { bool[,] inputMatrixFirst = { { true, false, true }, { true, false, true }, { true, false, true } }; BaseMatrix <bool> firstMatrix = new SquareMatrix <bool>(inputMatrixFirst); BaseMatrix <bool> secondMatrix = new SquareMatrix <bool>(inputMatrixFirst); Assert.Throws <RuntimeBinderException>(() => firstMatrix.Add(secondMatrix)); }
public void SumMatrix_InvalideParameterTypes() { SquareMatrix <object> matrix1 = new SquareMatrix <object>(1); matrix1[0, 0] = new object(); SymmetricMatrix <object> matrix2 = new SymmetricMatrix <object>(1); matrix2[0, 0] = new object(); Assert.Throws <InvalidOperationException>(() => matrix1.Add <object>(matrix2)); }
public static void TestMatrixAddition(TestData <double> testData) { Matrix <double> squareMatrix = new SquareMatrix <double>(testData.SqaureArray); Matrix <double> symmetricMatrix = new SymmetricMatrix <double>(testData.SymmmetricArray); Matrix <double> result = squareMatrix.Add(symmetricMatrix); double[,] resultArray = ExtractArray(result); Assert.That(resultArray, Is.EqualTo(testData.AdditionResult)); }
public void Add_MatricesTypeWithoutOperatorPlus_ArithmeticException() { TypeWithoutOperatorPlus[,] sourceArray = new TypeWithoutOperatorPlus[,] { {new TypeWithoutOperatorPlus(1), new TypeWithoutOperatorPlus(2)}, {new TypeWithoutOperatorPlus(3), new TypeWithoutOperatorPlus(4)}, }; SquareMatrix<TypeWithoutOperatorPlus> lhs = new SquareMatrix<TypeWithoutOperatorPlus>(sourceArray); SquareMatrix<TypeWithoutOperatorPlus> rhs = new SquareMatrix<TypeWithoutOperatorPlus>(sourceArray); lhs.Add(rhs); }
public void Add_SquareAddToSquareMatrixTests(SquareMatrix <int> firstMatrix, SquareMatrix <int> secondMatrix, SquareMatrix <int> expectedMatrix) { SquareMatrix <int> result = firstMatrix.Add(secondMatrix); for (int i = 0; i < result.Order; i++) { for (int j = 0; j < result.Order; j++) { Assert.AreEqual(expectedMatrix[i, j], result[i, j]); } } }
public void AddTestResultMatrixType() { var array = new[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; AbstractSquareMatrix <int> matrix1 = new SquareMatrix <int>(array); AbstractSquareMatrix <int> matrix2 = new SquareMatrix <int>(array); var result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SquareMatrix <int>), result.GetType()); matrix1 = new SquareMatrix <int>(array); matrix2 = new DiagonalMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SquareMatrix <int>), result.GetType()); matrix1 = new SquareMatrix <int>(array); matrix2 = new SymmetricMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SquareMatrix <int>), result.GetType()); matrix1 = new DiagonalMatrix <int>(array); matrix2 = new SquareMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SquareMatrix <int>), result.GetType()); matrix1 = new DiagonalMatrix <int>(array); matrix2 = new DiagonalMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(DiagonalMatrix <int>), result.GetType()); matrix1 = new DiagonalMatrix <int>(array); matrix2 = new SymmetricMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SymmetricMatrix <int>), result.GetType()); matrix1 = new SymmetricMatrix <int>(array); matrix2 = new SymmetricMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SymmetricMatrix <int>), result.GetType()); matrix1 = new SymmetricMatrix <int>(array); matrix2 = new DiagonalMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SymmetricMatrix <int>), result.GetType()); matrix1 = new SymmetricMatrix <int>(array); matrix2 = new SquareMatrix <int>(array); result = matrix1.Add(matrix2); Assert.AreEqual(typeof(SquareMatrix <int>), result.GetType()); }
public void Matrix_Sum_Square_And_DiagonalMatrix() { // Arrange Matrix <int> firstMatrix = new SquareMatrix <int>(firstSquareArray); Matrix <int> secondMatrix = new DiagonalMatrix <int>(firstDiagonalArray); // Act Matrix <int> result = firstMatrix.Add(secondMatrix); // Assert Assert.AreEqual(result[0, 0], 2); Assert.AreEqual(result[0, 1], 2); Assert.AreEqual(result[0, 2], 3); }
public void Matrix_Sum_Two_SquareMatrix() { // Arrange Matrix <int> firstMatrix = new SquareMatrix <int>(firstSquareArray); Matrix <int> secondMatrix = new SquareMatrix <int>(secondSquareArray); // Act Matrix <int> result = firstMatrix.Add(secondMatrix); // Assert Assert.AreEqual(result[0, 0], 2); Assert.AreEqual(result[0, 1], 0); Assert.AreEqual(result[2, 2], 18); }
public void Add_SquareMatrixAddSquareMatrix_MatrixReturned() { SquareMatrix<double> a = new SquareMatrix<double>(new double[,] { {1,2}, {1,2}}); SquareMatrix<double> b = new SquareMatrix<double>(new double[,] { {1,2}, {1,2}}); SquareMatrix<double> result = a.Add(b, (x,y) => x+y); SquareMatrix<double> trueResult = new SquareMatrix<double>( new double[,]{{2,4},{2,4}}); Assert.AreEqual(true, result.Equals(trueResult)); }
public void OperationMatrixTest_Add_ArgumentNullException() { int[,] paramMatrix = new int[, ] { { 3, 5, 4 }, { 5, 6, 8 }, { 4, 8, 7 } }; SquareMatrix <int> squareMatrix = new SquareMatrix <int>(paramMatrix); SymmetricalMatrix <int> symmetricalMatrix = null; Assert.Throws <ArgumentNullException>( () => squareMatrix.Add(symmetricalMatrix)); }
public void AdditionMatricesTests1() { SquareMatrix <int> lhs = new SquareMatrix <int>(_intArr1); DiagonalMatrix <int> rhs = new DiagonalMatrix <int>(_intArr2); int[,] expected = new int[, ] { { 2, 1, 1, 1 }, { 1, 2, 1, 1 }, { 1, 1, 2, 1 }, { 1, 1, 1, 2 } }; CollectionAssert.AreEqual(new SquareMatrix <int>(expected), lhs.Add(rhs)); }
public void SumOfSquareMatrixes() { var fsm = new SquareMatrix <int>(firstSquareMartix); var ssm = new SquareMatrix <int>(secondSquareMartix); var result = fsm.Add(ssm); CollectionAssert.AreEqual(new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, new int[, ] { { result[0, 0], result[0, 1], result[0, 2] }, { result[1, 0], result[1, 1], result[1, 2] }, { result[2, 0], result[2, 1], result[2, 2] } }); }
public void SumMatrixesTest_InputTwoMatrixes_AssertExpectedAndActualResult() { int[,] firstArray = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var firstMatrix = new SquareMatrix <int>(3, firstArray); int[,] secondArray = { { 0, 0, 0 }, { -2, -2, -2 }, { 15, 15, 15 } }; var secondMatrix = new SquareMatrix <int>(3, secondArray); int[,] expectedArray = { { 1, 2, 3 }, { 2, 3, 4 }, { 22, 23, 24 } }; var expectedMatrix = new SquareMatrix <int>(3, expectedArray); SquareMatrix <int> actualMatrix; actualMatrix = (SquareMatrix <int>)firstMatrix.Add <int>(secondMatrix); CollectionAssert.AreEqual(expectedMatrix, actualMatrix); }
public void SumMatrix_ValideParameterTypes() { SquareMatrix <int> matrix1 = new SquareMatrix <int>(1); matrix1[0, 0] = 1; SymmetricMatrix <int> matrix2 = new SymmetricMatrix <int>(1); matrix2[0, 0] = 2; //SumVisitor<int> summator = new SumVisitor<int>(); //summator.Visit(matrix1, matrix2, (x, y) => x + y); matrix1.Add <int>(matrix2); Assert.AreEqual(3, matrix1[0, 0]); }
public void Add_TwoSquareMatricesString_ReturnSquareMatrix() { var values = new string[, ] { { "first", "second" }, { "1", "2" } }; var first = new SquareMatrix <string>(values); var second = new SquareMatrix <string>(values); var expectedValues = new string[, ] { { "firstfirst", "secondsecond" }, { "11", "22" } }; var result = first.Add(second); }
public void AddExtentionTest() { var array = arrayData; var matrix = new SquareMatrix <int>(array); var otherMatrix = new SquareMatrix <int>(array); var resultMatrix = matrix.Add(otherMatrix); for (int i = 0; i < matrix.Order; i++) { for (int j = 0; j < matrix.Order; j++) { Assert.AreEqual(resultMatrix[i, j], matrix[i, j] + otherMatrix[i, j]); } } }
public void AdditionTest() { matrix = new SymmetricMatrix <string>("sym1", "sym3", "sym3", "sym1"); var square = new SquareMatrix <string>(new string[2, 2] { { "sq1", "sq2" }, { "sq3", "sq4" } }); var sq1 = matrix.Add(square); var sq2 = square.Add(matrix); Assert.IsInstanceOf(typeof(SquareMatrix <string>), sq1); Assert.IsInstanceOf(typeof(SquareMatrix <string>), sq2); CollectionAssert.AreEqual(new string[4] { "sym1sq1", "sym3sq2", "sym3sq3", "sym1sq4" }, sq1.GetElements()); CollectionAssert.AreEqual(new string[4] { "sq1sym1", "sq2sym3", "sq3sym3", "sq4sym1" }, sq2.GetElements()); var symmetric = new SymmetricMatrix <string>(new string[2, 2] { { "1sym", "3sym" }, { "3sym", "1sym" } }); var sum1 = matrix.Add(symmetric); var sum2 = symmetric.Add(matrix); Assert.IsInstanceOf(typeof(SymmetricMatrix <string>), sum1); Assert.IsInstanceOf(typeof(SymmetricMatrix <string>), sum2); CollectionAssert.AreEqual(new string[4] { "sym11sym", "sym33sym", "sym33sym", "sym11sym" }, sum1.GetElements()); CollectionAssert.AreEqual(new string[4] { "1symsym1", "3symsym3", "3symsym3", "1symsym1" }, sum2.GetElements()); var diagonal = new DiagonalMatrix <string>(2, "DIAGONAL"); sum1 = sum1.Add(diagonal); sum2 = diagonal.Add(sum2); Assert.IsInstanceOf(typeof(SymmetricMatrix <string>), sum1); Assert.IsInstanceOf(typeof(SymmetricMatrix <string>), sum2); CollectionAssert.AreEqual(new string[4] { "sym11symDIAGONAL", "sym33sym", "sym33sym", "sym11symDIAGONAL" }, sum1.GetElements()); CollectionAssert.AreEqual(new string[4] { "DIAGONAL1symsym1", "3symsym3", "3symsym3", "DIAGONAL1symsym1" }, sum2.GetElements()); }
public void SquareMatrix_AdditionException() { var first = new int[,] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; var second = new int[,] { {1, 2}, {4, 5} }; var lolFirst = new SquareMatrix<int>(first); var lolSecond = new SquareMatrix<int>(second); var lolThird = lolFirst.Add(lolSecond); }
public void SumTest_SquarePlusSymmetric_Square() { var matrix1 = new SquareMatrix <int>(2); matrix1[0, 0] = 1; var matrix2 = new SymmetricMatrix <int>(2); matrix2[0, 0] = 1; matrix2[1, 1] = 2; matrix1.Add(matrix2); int[] array = { 2, 0, 0, 2 }; Assert.IsTrue(IsEqual(matrix1, array)); }
static void Main(string[] args) { int[,] sqareArray = GenerateSquareArray(4); Print(sqareArray); int[,] simmetricArray = GenerateSimmetricArray(4); Print(simmetricArray); int[,] diagonalArray = GenerateDiagonalArray(4); Print(diagonalArray); SquareMatrix<int> squareMatrix = new SquareMatrix<int>(sqareArray); SimmetricMatrix<int> simmetricMatrix = new SimmetricMatrix<int>(simmetricArray); DiagonalMatrix<int> diagonalMatrix = new DiagonalMatrix<int>(diagonalArray); squareMatrix.Add(simmetricMatrix); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Диагональная матрица"); DiagonalMatrix<int> diagonalInt = new DiagonalMatrix<int>(new int[] { 1, 2, 3, 4 }); diagonalInt.Print(); diagonalInt.amendEvent.amendIMatrixItem += (s, e) => Console.WriteLine(e.massage); diagonalInt[2, 2] = 5; diagonalInt.Print(); Console.WriteLine("Симметрическая матрица"); SymmetricMatrix<int> symmetricInt = new SymmetricMatrix<int>(new int[][] { new int[] {1,2,3,4}, new int[] { 2,3,4}, new int[] { 3,4}, new int[] { 4} }); symmetricInt.Print(); symmetricInt.amendEvent.amendIMatrixItem += (s, e) => Console.WriteLine(e.massage); symmetricInt[1, 3] = 9; symmetricInt.Print(); Console.WriteLine("Квадратная матрица"); SquareMatrix<int> square = new SquareMatrix<int>(new int[,] { {1,1,1,1}, {2,2,2,2}, {3,3,3,3}, {4,4,4,4} }); square.Print(); square.amendEvent.amendIMatrixItem += (s, e) => Console.WriteLine(e.massage); square[2, 2] = 10; square.Print(); Console.WriteLine("Квадратная + Симметрическая"); square.Add(symmetricInt); square.Print(); Console.ReadKey(); }
public void TestAddDouble() { double[,] m = { {0.1, 0.2, 0.3}, {0.2, 0.3, 0.4}, {0.3, 0.4, 0.5} }; double[] m2 = { 0.3, 0.4, 0.5}; SquareMatrix<double> matr1 = new SquareMatrix<double>(m); matr1.Add(new DiagonalMatrix<double>(m2)); double[,] rezult = { {0.4, 0.2, 0.3}, {0.2, 0.7, 0.4}, {0.3, 0.4, 1.0} }; for(int i = 0; i < 3; i++) for(int j = 0; j < 3 ; j++) Assert.AreEqual(matr1[i,j], rezult[i,j]); }
public void Add_MatricesDifferentOreder_ArithmeticException() { SquareMatrix<int> lhs = new SquareMatrix<int>(1); SquareMatrix<int> rhs = new SquareMatrix<int>(2); lhs.Add(rhs); }