private static bool TestRemovalOrderingOnProgram(Program program, TextWriter writer) { var betterSolutionFound = false; try { var dareController = new DareController(program); var removalOrderTesterAssert = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetAssertDictionary(), program); var assertSolutions = removalOrderTesterAssert.TestDifferentRemovals(); var removalOrderTesterInvar = new RemovalOrderTester <MaybeFreeExpression>(dareController.AllRemovableTypes.GetInvariantDictionary(), program); var invariantSolutions = removalOrderTesterInvar.TestDifferentRemovals(); writer.WriteLine("ASSERTS for " + program.Name); writer.WriteLine(); betterSolutionFound = PrintResults(assertSolutions, writer); writer.WriteLine(); writer.WriteLine("INVARIANTS for " + program.Name); writer.WriteLine(); betterSolutionFound = PrintResults(invariantSolutions, writer) || betterSolutionFound; } catch (NotValidException e) { writer.WriteLine("Program " + program.Name + "was not valid: " + e.Message); } catch { //ignore } return(betterSolutionFound); }
private long GetCompleteDareTime() { Stopwatch stopwatch = new Stopwatch(); var completeDareProgram = SimpleCloner.CloneProgram(_program); var dareController = new DareController(completeDareProgram); stopwatch.Start(); var removalOrderTesterAssert = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetAssertDictionary(), completeDareProgram); removalOrderTesterAssert.TestDifferentRemovals(); var removalOrderTesterInvar = new RemovalOrderTester <MaybeFreeExpression>(dareController.AllRemovableTypes.GetInvariantDictionary(), completeDareProgram); removalOrderTesterInvar.TestDifferentRemovals(); var removalOrderTesterLemmaCall = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetLemmaCallDictionary(), completeDareProgram); removalOrderTesterLemmaCall.TestDifferentRemovals(); var removalOrderTesterDecreases = new RemovalOrderTester <Expression>(dareController.AllRemovableTypes.GetDecreasesDictionary(), completeDareProgram); removalOrderTesterDecreases.TestDifferentRemovals(); var removalOrderTesterCalc = new RemovalOrderTester <Statement>(dareController.AllRemovableTypes.GetCalcDictionary(), completeDareProgram); removalOrderTesterCalc.TestDifferentRemovals(); stopwatch.Stop(); return(stopwatch.ElapsedMilliseconds); }