Beispiel #1
0
        public static void FindNthRoot_NumberDegreePrecisionResult(double number, int degree,
                                                                   double precision, double expected)
        {
            double actual = RootAlgorithm.FindNthRoot(number, degree, precision);

            Assert.AreEqual(expected, actual, precision);
        }
        public void FindNthRoot_NumberResultWithNegativeDegree()
        {
            double number   = 97.65625;
            int    degree   = -5;
            double expected = 0.4;

            var actual = RootAlgorithm.FindNthRoot(number, degree);

            Assert.AreEqual(expected, actual, 0.0001);
        }
        public void FindNthRoot_NumberResultWithDouble()
        {
            double number   = 0.001;
            int    degree   = 3;
            double expected = 0.1;

            var actual = RootAlgorithm.FindNthRoot(number, degree);

            Assert.AreEqual(expected, actual, 0.0001);
        }
        public void FindNthRoot_NumberResultWithPositiveDegree()
        {
            double number   = 1;
            int    degree   = 5;
            int    expected = 1;

            var actual = RootAlgorithm.FindNthRoot(number, degree);

            Assert.AreEqual(expected, actual, 0.0001);
        }
Beispiel #5
0
 public void FindNthRoot_ArgumentOutOfRangeException(double number, int degree,
                                                     double precision, double expected)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => RootAlgorithm.FindNthRoot(number, degree, precision));
 }
Beispiel #6
0
        public static void FindNthRoot_NumberDegreeResult(double number, int degree, double expected)
        {
            double actual = RootAlgorithm.FindNthRoot(number, degree);

            Assert.AreEqual(expected, actual, 0.0001);
        }
 public void FilterDigit_ThrowArgumentOutOfRangeException()
 => RootAlgorithm.FindNthRoot(999.9, 3, -7);