public void Run() { var random = new Random(); for (var n = 1; n < 20; n++) { var xs = new long[n]; for (var k = 1; k < n + 2; k++) { for (var i = 0; i < xs.Length; i++) { xs[i] = random.Next(1, n + 1); } var bruteForceSolver = new BruteForceSolver(n, k, xs); var fastSolver = new FastSolver(n, k, xs); var expected = bruteForceSolver.Solve(); var actual = fastSolver.Solve(); if (actual != expected) { Console.WriteLine("{0} {1}", n, k); Console.WriteLine(string.Join(" ", xs)); Console.WriteLine("Expected {0}, actual {1}", expected, actual); bruteForceSolver.Solve(); fastSolver.Solve(); } } } }
public void Run() { var bruteForce = new BruteForceSolver(); var fast = new FastSolver(); for (var n = 3; n < 10; n++) { foreach (var ps in Quiz.AllPropositions(n)) { var s = new string(ps); var expected = bruteForce.Solve(n, s); var actual = fast.Solve(n, s); if (expected != actual) { System.Diagnostics.Debug.Assert(false); } } } }