コード例 #1
0
        public void FindNthRootSimpleTest8()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = 0.545;

            Assert.AreEqual(expected, numericFun.FindNthRoot(0.004241979, 9, 0.00000001));
        }
コード例 #2
0
        public void FindNthRootSimpleTest7()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = -0.2;

            Assert.AreEqual(expected, numericFun.FindNthRoot(-0.008, 3, 0.1));
        }
コード例 #3
0
        public void FindNthRootSimpleTest6()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = 0.3;

            Assert.AreEqual(expected, numericFun.FindNthRoot(0.0081, 4, 0.01));
        }
コード例 #4
0
        public void FindNthRootSimpleTest5()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = 0.6;

            Assert.AreEqual(expected, numericFun.FindNthRoot(0.0279936, 7, 0.0001));
        }
コード例 #5
0
        public void FindNthRootSimpleTest4()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = 0.45;

            Assert.AreEqual(expected, numericFun.FindNthRoot(0.04100625, 4, 0.0001));
        }
コード例 #6
0
        public void FindNthRootSimpleTest1()
        {
            NumericFun numericFun = new NumericFun();
            double     expected   = 1;

            Assert.AreEqual(expected, numericFun.FindNthRoot(1, 5, 0.0001));
        }
コード例 #7
0
        public void FindNthRootNegativeRootPowerTest()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentException>(() => numericFun.FindNthRoot(8, -2, 0.001), "Root power can't be equal or less than zero");
        }
コード例 #8
0
        public void FindNthRootNegativeNumberWithOddRootTest()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentException>(() => numericFun.FindNthRoot(-2, 2, 0.001), "Number can't be negative with odd root power");
        }
コード例 #9
0
        public void FindNthRootArgumentOutOfRangeTest2()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentOutOfRangeException>(() => numericFun.FindNthRoot(8, 15, -0.6), "Precision can't be equal or less than zero");
        }