public void TestAddRowValues2() { ObjectMatrix <int> matrix = GetTestMatrix(); int columnCount = matrix.Columns; int rowCount = matrix.Rows; matrix.AddRow(0, -1, -2); Assert.AreEqual(matrix.Columns, columnCount); Assert.AreEqual(matrix.Rows, rowCount + 1); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { Assert.AreEqual(matrix[i, j], i + j); } } Assert.AreEqual(matrix[rowCount, 0], 0); Assert.AreEqual(matrix[rowCount, 1], -1); Assert.AreEqual(matrix[rowCount, 2], -2); Assert.AreEqual(matrix[rowCount, 3], 0); Assert.AreEqual(matrix[rowCount, 4], 0); }
public void TestAddRowValues1() { ObjectMatrix <int> matrix = GetTestMatrix(); int columnCount = matrix.Columns; int rowCount = matrix.Rows; matrix.AddRow(0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14); Assert.AreEqual(matrix.Columns, columnCount); Assert.AreEqual(matrix.Rows, rowCount + 1); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { Assert.AreEqual(matrix[i, j], i + j); } } for (int i = 0; i < columnCount; i++) { Assert.AreEqual(matrix[rowCount, i], -1 * i); } }
public void TestAddRow() { ObjectMatrix <int> matrix = GetTestMatrix(); int columnCount = matrix.Columns; int rowCount = matrix.Rows; matrix.AddRow(); Assert.AreEqual(matrix.Columns, columnCount); Assert.AreEqual(matrix.Rows, rowCount + 1); for (int i = 0; i < rowCount; i++) { for (int j = 0; j < columnCount; j++) { Assert.AreEqual(matrix[i, j], i + j); } } for (int i = 0; i < columnCount; i++) { Assert.AreEqual(matrix[rowCount, i], default(double)); } }
public void AddRowExample() { var matrix = new ObjectMatrix <double>(2, 2); matrix[0, 0] = 1; matrix[0, 1] = 2; matrix[1, 0] = 3; matrix[1, 1] = 4; Assert.AreEqual(2, matrix.Columns); Assert.AreEqual(2, matrix.Rows); matrix.AddRow(); Assert.AreEqual(2, matrix.Columns); Assert.AreEqual(3, matrix.Rows); }
public void AddRowValuesExample() { var matrix = new ObjectMatrix<double>(2, 2); matrix[0, 0] = 1; matrix[0, 1] = 2; matrix[1, 0] = 3; matrix[1, 1] = 4; Assert.AreEqual(2, matrix.Columns); Assert.AreEqual(2, matrix.Rows); matrix.AddRow(5, 6); Assert.AreEqual(2, matrix.Columns); Assert.AreEqual(3, matrix.Rows); Assert.AreEqual(5, matrix[2, 0]); Assert.AreEqual(6, matrix[2, 1]); }
public void TestInvalidAddRowValues2() { ObjectMatrix <int> matrix = GetTestMatrix(); matrix.AddRow(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }
public void TestInvalidAddRowValues1() { ObjectMatrix <int> matrix = GetTestMatrix(); matrix.AddRow((int[])null); }