static void Main(string[] args) { System.Console.WriteLine("\n===== Opgave 1 : Faculteit =====\n"); Opgave1.Run(); System.Console.WriteLine("\n===== Opgave 2 : Fibonacci =====\n"); Opgave2.Run(); System.Console.WriteLine("\n===== Opgave 3 : OmEnOm =====\n"); Opgave3.Run(); System.Console.WriteLine("\n===== Opgave 4 : Enen =====\n"); Opgave4.Run(); System.Console.WriteLine("\n===== Opgave 6 : ForwardString =====\n"); Opgave6.Run(); System.Console.WriteLine("\n===== Opgave 7 : Sorting =====\n"); Sorter isort = new InsertionSort(); Sorter msort = new MergeSort(); Sorter ssort = new ShellSort(); isort.Run(); msort.Run(); ssort.Run(); int[] numbers = { 100, 1000, 10000 }; foreach (int num in numbers) { isort.RunWithTimer(num); msort.RunWithTimer(num); ssort.RunWithTimer(num); } }
public void testPrintLetters() { Opgave1 opgave = new Opgave1(); Assert.IsTrue("AAAZZZ".Equals(opgave.printLetters(3))); Assert.IsTrue("".Equals(opgave.printLetters(0))); }
public void testPrintLetters2() { Opgave1 opgave = new Opgave1(); Assert.IsTrue("AAAZZZZZ".Equals(opgave.printLetters2(3, 5))); Assert.IsTrue("AA".Equals(opgave.printLetters2(2, 0))); }
public static void Main() { Opgave1 Tom = () => Console.WriteLine("Work time"); Tom(); Opgave2 vibe = () => 14.2f; Console.WriteLine(vibe()); Opgave3 three = (a, b, c) => Console.WriteLine("oh yeah big brain time"); three(14, "ooh", 12); Console.ReadKey(); }
public void Factorial(string fun, int n, long expected) { long actual; System.Func <int, long> f = null; // Arrange if (fun == "iterative") { f = (x) => Opgave1.FacIterative(x); } else if (fun == "recursive") { f = (x) => Opgave1.FacRecursive(x); } Assert.IsNotNull(f); // Act actual = f(n); // Assert Assert.AreEqual(expected, actual); }