Example #1
0
        public void TestAddMultipleRows()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int columnCount = matrix.Columns;
            int rowCount    = matrix.Rows;

            matrix.AddRows(3);

            Assert.AreEqual(matrix.Columns, columnCount);
            Assert.AreEqual(matrix.Rows, rowCount + 3);

            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++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Assert.AreEqual(matrix[rowCount + j, i], default(double));
                }
            }
        }
Example #2
0
        public void TestInvalidAddMultipleRows2()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int columnCount = matrix.Columns;
            int rowCount    = matrix.Rows;

            matrix.AddRows(0);
        }
Example #3
0
        public void AddRowsExample()
        {
            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.AddRows(2);

            Assert.AreEqual(2, matrix.Columns);
            Assert.AreEqual(4, matrix.Rows);
        }
        public void AddRowsExample()
        {
            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.AddRows(2);

            Assert.AreEqual(2, matrix.Columns);
            Assert.AreEqual(4, matrix.Rows);
        }