예제 #1
0
        public void TestInvalidCopyTo2()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int[] array = new int[matrix.Rows * matrix.Columns - 1];

            matrix.CopyTo(array, 0);
        }
예제 #2
0
        public void CopyToExample()
        {
            var matrix = new ObjectMatrix <double>(2, 2);

            matrix[0, 0] = 1;
            matrix[0, 1] = 2;
            matrix[1, 0] = 3;
            matrix[1, 1] = 4;

            var array = new double[matrix.Rows * matrix.Columns];

            matrix.CopyTo(array, 0);

            Assert.AreEqual(1, array[0]);
            Assert.AreEqual(4, array[3]);
        }
예제 #3
0
        public void TestCopyTo()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int[] array = new int[matrix.Rows * matrix.Columns];

            matrix.CopyTo(array, 0);

            List <int> l = new List <int>(array);

            for (int i = 0; i < matrix.Rows; i++)
            {
                for (int j = 0; j < matrix.Columns; j++)
                {
                    Assert.AreEqual(l.Contains(i + j), true);
                }
            }
        }
예제 #4
0
        public void CopyToExample()
        {
            var matrix = new ObjectMatrix<double>(2, 2);
            matrix[0, 0] = 1;
            matrix[0, 1] = 2;
            matrix[1, 0] = 3;
            matrix[1, 1] = 4;

            var array = new double[matrix.Rows * matrix.Columns];

            matrix.CopyTo(array, 0);

            Assert.AreEqual(1, array[0]);
            Assert.AreEqual(4, array[3]);
        }
예제 #5
0
        public void TestNullCopyTo()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            matrix.CopyTo(null, 0);
        }