예제 #1
0
파일: DareMain.cs 프로젝트: minill/shorty
        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);
        }
예제 #2
0
        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);
        }