Exemplo n.º 1
0
        public void SimpsonMethod_InvalidIterationCount_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 0;
            double b = 20;
            double h = -0.01;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Sims(a, b, h, func);
        }
Exemplo n.º 2
0
        public void ParallelTooShortStep_Sims_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 1;
            double b = 10000;
            double h = 0.0000001;

            //act
            IntegralMath math = new IntegralMath();
            double       res  = math.pSims(a, b, h, func);
        }
Exemplo n.º 3
0
        public void ParallelMixedUpLimits_Sims_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 20;
            double b = -20;
            double h = 0.001;

            //act
            IntegralMath math = new IntegralMath();
            double       res  = math.pSims(a, b, h, func);
        }
Exemplo n.º 4
0
        public void TooShortStep_Trap_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 1;
            double b = 10000;
            double h = 0.0000001;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Trap(a, b, h, func);
        }
Exemplo n.º 5
0
        public void MixedUpLimits_Trap_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 20;
            double b = -20;
            double h = 0.001;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Trap(a, b, h, func);
        }
Exemplo n.º 6
0
        public void TrapMethod_InvalidStride_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 0;
            double b = 20;
            double h = -0.01;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Trap(a, b, h, func);
        }
Exemplo n.º 7
0
        public void SimsMethod_MaxIterationNumber_Exception()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a = 0;
            double b = 20;
            int    m = 100000000;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Sims(a, b, m, func);
        }
Exemplo n.º 8
0
        public void SimsMethod_2X_400Returned()
        {
            //assert
            Func <double, double> func = x => 2 * x;
            double a           = 0;
            double b           = 20;
            double h           = 0.001;
            double correct_res = 400;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Sims(a, b, h, func);

            //arrange
            Assert.AreEqual(correct_res, res, 0.0001);
        }
Exemplo n.º 9
0
        public void SimsMethod_XmultiplyX_2666Returned()
        {
            //assert
            Func <double, double> func = x => x * x;
            double a           = 0;
            double b           = 20;
            double h           = 0.001;
            double correct_res = 2666.66;

            //act
            IMath  math = new IntegralMath();
            double res  = math.Sims(a, b, h, func);

            //arrange
            Assert.AreEqual(correct_res, res, 0.01);
        }
Exemplo n.º 10
0
        public void ParallelTrapMethod_2X_400Returned()
        {
            //assert
            Func <double, double> func = x => x * 2;
            double a           = 0;
            double b           = 20;
            double h           = 0.001;
            double correct_res = 400.0;

            //act
            IntegralMath math = new IntegralMath();
            double       res  = math.pTrap(a, b, h, func);

            //arrange
            Assert.AreEqual(correct_res, res, 0.001);
        }