예제 #1
0
        public void CalculateQuadraticEquationRoots_DeltaEqualsZero_OneRoot(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 1);
        }
예제 #2
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedDeltaLowerthanZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.Less(rc.Delta, 0);
        }
예제 #3
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedMessageForZeroRoots(double firstValue, double secondValue, double thirdValue, string message)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.ToString(), message);
        }
예제 #4
0
        public void RootSeacherTest3()
        {
            double actual   = RootCalculator.FindNthRoot(0.0279936, 7, 0.0001);
            double expected = 0.6;

            Assert.IsTrue(Math.Abs(expected - actual) < 0.0001);
        }
예제 #5
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaLowerThanZero_ExpectedZeroRoots(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 0);
        }
예제 #6
0
        public void RootSeacherTest4()
        {
            double actual   = RootCalculator.FindNthRoot(-0.008, 3, 0.1);
            double expected = -0.2;

            Assert.IsTrue(Math.Abs(expected - actual) < 0.1);
        }
예제 #7
0
        public void CalculateQuadraticEquationRoots_NegativeFirstPositiveThirdValue_DeltaAlwaysHigherThanZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.Greater(rc.Delta, 0);
        }
예제 #8
0
        public void CalculateQuadraticEquationRoots_NegativeFirstPositiveThirdValue_TwoRootsExpected(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 2);
        }
예제 #9
0
        public void CalculateQuadraticEquationRoots_DeltaHigherThanZero_TwoRootsExpected(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Roots.Count, 2);
        }
예제 #10
0
        public void RootSeacherTest5()
        {
            double actual   = RootCalculator.FindNthRoot(0.004241979, 9, 0.00000001);
            double expected = 0.545;

            Assert.IsTrue(Math.Abs(expected - actual) < 0.00000001);
        }
예제 #11
0
        public void RootSeacherTest6()
        {
            double actual   = RootCalculator.FindNthRoot(0.04100625, 4, 0.0001);
            double expected = 0.45;

            Assert.IsTrue(Math.Abs(expected - actual) < 0.0001);
        }
예제 #12
0
        public void RootSeacherTest1()
        {
            double actual   = RootCalculator.FindNthRoot(1, 5, 0.0001);
            double expected = 1;

            Assert.IsTrue(Math.Abs(expected - actual) < 0.0001);
        }
예제 #13
0
        public void CalculateQuadraticEquationRoots_ExampleWithDeltaEqualsZero_DelatEqualsZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            rc.RootCalculate();
            Assert.AreEqual(rc.Delta, 0);
        }
예제 #14
0
 public void RootSeacherTest7()
 {
     try
     {
         double actual = RootCalculator.FindNthRoot(0.04100625, 4, -7);
         Assert.Fail("No Exception(");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is ArgumentOutOfRangeException);
     }
 }
        static void Main(string[] args)
        {
            Console.WriteLine(IntMerger.IntMerger.Merge(8, 15, 3, 8));

            long time;

            Console.WriteLine(BiggerNubmerSearcher.BiggerNubmerSearcher.FindNextBiggerNumber
                                  (1234321, out time));

            RootCalculator.FindNthRoot(0.004241979, 9, 0.00000001);

            Console.ReadLine();
        }
예제 #16
0
        public void CalculateQuadraticEquationRoots_ExampleWithFirstValueZero_ExpectedException(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            Assert.Throws <Exception>(() => rc.RootCalculate());
        }
예제 #17
0
        public void CalculateQuadraticEquationRoots_RootCalculateMethodNotUsed_ExpectedRootCountZero(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            Assert.AreEqual(rc.Roots.Count, 0);
        }
예제 #18
0
        public void CalculateQuadraticEquationRoots_RootCalculateMethodNotUsed_ExpectedMessage(double firstValue, double secondValue, double thirdValue, string message)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            Assert.AreEqual(rc.ToString(), message);
        }
예제 #19
0
        public void CalculateQuadraticEquationRoots_RootCalculateMethodNotUsed_ExpectedNanDelta(double firstValue, double secondValue, double thirdValue)
        {
            RootCalculator rc = new RootCalculator(firstValue, secondValue, thirdValue);

            Assert.AreEqual(rc.Delta, Double.NaN);
        }