Esempio n. 1
0
        public void Test_MatrixTrace_Sum()

        {
            MatrixTrace mt = new MatrixTrace(2, 2);

            double expected = mt.Matrix[0, 0] + mt.Matrix[1, 1];

            mt.Print();

            double result = mt.Sum;

            Assert.Equal(expected, result);
        }
Esempio n. 2
0
        public void Test_MatrixTrace_Sum1()

        {
            MatrixTrace trace = new MatrixTrace(3, 3);

            trace.Matrix = new double[3, 3] {
                { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }
            };

            double expected = 12;

            trace.Print();

            double result = trace.Sum;

            Assert.Equal(expected, result);
        }
Esempio n. 3
0
        public void Test_MatrixTrace_Random()
        {
            MatrixTrace mt = new MatrixTrace(10, 10);

            double[,] matrix = mt.Matrix;

            bool expected = true;

            bool result = true;

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    if ((matrix[i, j] < 0) || (matrix[i, j] > 100))
                    {
                        result = false;
                    }
                }
            }

            Assert.Equal(expected, result);
        }