Пример #1
0
        static void Main(string[] args)
        {
            int noOfInserts = 50000;

            PerformTest("List", new ListTester(), noOfInserts);
            PerformTest("Linked List", new LinkedListTester(), noOfInserts);
            PerformTest("Hash Set", new HashSetTester(), noOfInserts);

            Console.WriteLine("Test af Fibonacci");
            Console.WriteLine("Test af Fibonacci rekursivt: " + TimedTester.MeasureRunTime(() =>
                                                                                           { RekursionsTest.Fibonacci(30); }) + " ms.");
            Console.WriteLine("Test af Fibonacci iterativt: " + TimedTester.MeasureRunTime(() =>
                                                                                           { RekursionsTest.FibonacciIterativt(30); }) + " ms.");



            KeepConsoleWindowOpen();
        }
 public long FindRandom(int noOfFinds, int maxValue)
 {
     return(TimedTester.MeasureRunTimeLoop(() => { FindRandomStatement(Generator.Next(maxValue)); }, noOfFinds));
 }
 public long DeleteRandom(int noOfDeletes)
 {
     return(TimedTester.MeasureRunTimeLoop(DeleteRandomStatement, noOfDeletes));
 }
 public long LookupRandom(int noOfLookups)
 {
     return(TimedTester.MeasureRunTimeLoop(LookupRandomStatement, noOfLookups));
 }
 public long InsertFront(int noOfToInserts, int maxValue)
 {
     return(TimedTester.MeasureRunTimeLoop(() => { InsertFrontStatement(Generator.Next(maxValue)); }, noOfToInserts));
 }
 public long InsertFront(int valuesToAdd, int maxValue)
 {
     return(TimedTester.MeasureRunTimeLoop(() => { InsertFrontStatement(Generator.Next(maxValue)); }, valuesToAdd));
 }
 public long AddInitial(int valuesToAdd, int maxValue)
 {
     return(TimedTester.MeasureRunTimeLoop(() => { AddInitialStatement(Generator.Next(maxValue)); }, valuesToAdd));
 }