Exemple #1
0
        static void Main(string[] args)
        {
#if RELEASE
            BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
#else
            while (true)
            {
                Console.WriteLine("Type 0 to exit!");
                Console.Write("Number: ");
                var strNumber = Console.ReadLine();
                if (strNumber == "0")
                {
                    break;
                }

                if (ulong.TryParse(strNumber, out ulong number))
                {
                    var calc = new FibonacciCalc();
                    Console.WriteLine(calc.Recursive(number));
                    Console.WriteLine(calc.RecursiveWithMemoization(number));
                    Console.WriteLine(calc.Iterative(number));
                }
            }
#endif
        }
        static void Main(string[] args)
        {
            FibonacciCalc myFibonaci = new FibonacciCalc();


            //Console.WriteLine(myFibonaci.Recursive(35));
            //Console.WriteLine(myFibonaci.RecursiveWithMemoizationStarter(35));
            //Console.WriteLine(myFibonaci.IterativeWithArrays(35));
            //Console.WriteLine(myFibonaci.Iterative(35));

            //Console.WriteLine(myFibonaci.noCalls);

            BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
        }
Exemple #3
0
        static void Main(string[] args)
        {
#if DEBUG
            var fc = new FibonacciCalc();

            foreach (var n in fc.Data())
            {
                var recursive = fc.Recursive(n);
                var recursiveWithMemoization = fc.RecursiveWithMemoization(n);
                var iterative = fc.Iterative(n);

                Debug.Assert(recursive == recursiveWithMemoization);
                Debug.Assert(recursive == iterative);
            }
#endif

            BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
        }