Esempio n. 1
0
        public void Matrix_Transpose_Test()
        {
            //Arrange
            IntegerMatrix m1 = GenerateRandomIntegerMatrix();
            IntegerMatrix m2 = (IntegerMatrix)m1.GetTranspose();

            for (int i = 0; i < m1.RowSize; i++)
            {
                for (int j = 0; j < m1.ColumnSize; j++)
                {
                    Assert.AreEqual(m1.Get(i, j), m2.Get(j, i));
                }
            }
        }
Esempio n. 2
0
        public void Integer_Matrix_Value_Change_Test()
        {
            //Arrange
            int           row      = rand.Next(1, 10);
            int           col      = rand.Next(1, 10);
            int           rowIndex = rand.Next(1, row - 1);
            int           colIndex = rand.Next(1, col - 1);
            IntegerMatrix m1       = new IntegerMatrix(row, col);

            //Act
            m1.Replace(rowIndex, colIndex, 5); //value doesnt matter just cant be zero
            //Assert
            Assert.AreEqual(m1.Get(rowIndex, colIndex), 5);
        }
Esempio n. 3
0
        public void Column_Append_Test()
        {
            //Arrange
            IntegerMatrix m1  = GenerateRandomIntegerMatrix();
            int           row = rand.Next(1, 10);
            IntegerMatrix m2  = new IntegerMatrix(row, m1.ColumnSize);
            //Act
            IntegerMatrix m3 = (IntegerMatrix)m1.AppendByColumn(m2);

            //Assert
            for (int i = m1.RowSize; i < m3.RowSize; i++)
            {
                for (int j = 0; j < m1.ColumnSize; j++)
                {
                    Assert.AreEqual(m3.Get(i, j), 0);
                }
            }
        }
Esempio n. 4
0
        public void Row_Append_Test()
        {
            //Arrange
            IntegerMatrix m1  = GenerateRandomIntegerMatrix();
            int           col = rand.Next(1, 10);
            IntegerMatrix m2  = new IntegerMatrix(m1.RowSize, col);
            //Act
            IntegerMatrix m3 = (IntegerMatrix)m1.AppendByRow(m2);

            //Assert
            for (int i = 0; i < m1.RowSize; i++)
            {
                for (int j = m1.ColumnSize; j < m3.ColumnSize; j++)
                {
                    Assert.AreEqual(m3.Get(i, j), 0);
                }
            }
        }