public static int GetExitCode(ResultCounter counter) { if (counter.AllVerified()) { return((int)ToolExitCodes.SUCCESS); } if (counter.HasInternalError()) { return((int)ToolExitCodes.INTERNAL_ERROR); } if (counter.HasNonInternalError()) { return((int)ToolExitCodes.OTHER_ERROR); } if (counter.VerificationErrors > 0) { return((int)ToolExitCodes.VERIFICATION_ERROR); } // This should be unreachable throw new InvalidOperationException("Hit unreachable code"); }
public static ResultCounter GetNewCounterWithInputError() { var temp = new ResultCounter(); temp.InputErrors = 1; return(temp); }
// Use this for initialization void Start() { _frogACount = ResultCounter.GetFrogAResult(); _frogBCount = ResultCounter.GetFrogBResult(); if (_frogACount > _frogBCount) { Instantiate(FrogAWin, transform.position, transform.rotation); } else if (_frogACount < _frogBCount) { Instantiate(FrogBWin, transform.position, transform.rotation); } else { if (Random.Range(0, 2) == 0) { Instantiate(FrogAWin, transform.position, transform.rotation); } else { Instantiate(FrogBWin, transform.position, transform.rotation); } } }
static ResultCounter VerifyFiles(List <string> fileNames) { Contract.Requires(cce.NonNullElements(fileNames)); Program program = GVUtil.IO.ParseBoogieProgram(fileNames, false); if (program == null) { return(ResultCounter.GetNewCounterWithInputError()); } KernelAnalyser.PipelineOutcome oc = KernelAnalyser.ResolveAndTypecheck(program, fileNames[fileNames.Count - 1]); if (oc != KernelAnalyser.PipelineOutcome.ResolvedAndTypeChecked) { return(ResultCounter.GetNewCounterWithInputError()); } KernelAnalyser.EliminateDeadVariables(program); KernelAnalyser.Inline(program); KernelAnalyser.CheckForQuantifiersAndSpecifyLogic(program); CommandLineOptions.Clo.PrintUnstructured = 2; if (CommandLineOptions.Clo.LoopUnrollCount != -1) { Debug.Assert(!CommandLineOptions.Clo.ContractInfer); program.UnrollLoops(CommandLineOptions.Clo.LoopUnrollCount, CommandLineOptions.Clo.SoundLoopUnrolling); } return(VerifyProgram(program)); }
public HomeController( IIngredientHandler ingredientHandler, ResultCounter resultCounter, IDatabase db) { _ingredientHandler = ingredientHandler ?? throw new ArgumentNullException(nameof(ingredientHandler)); _resultCounter = resultCounter ?? throw new ArgumentNullException(nameof(resultCounter)); _db = db ?? throw new ArgumentNullException(nameof(db)); }
public static void ProcessOutcome( Program program, string implName, VC.VCGen.Outcome outcome, List <Counterexample> errors, string timeIndication, ref ResultCounter counters) { switch (outcome) { default: Contract.Assert(false); // unexpected outcome throw new cce.UnreachableException(); case ConditionGeneration.Outcome.ReachedBound: Utilities.IO.Inform("{0}verified", timeIndication); Console.WriteLine("Stratified Inlining: Reached recursion bound of {0}", CommandLineOptions.Clo.RecursionBound); counters.Verified++; break; case ConditionGeneration.Outcome.Correct: if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed) { Utilities.IO.Inform("{0}credible", timeIndication); counters.Verified++; } else { Utilities.IO.Inform("{0}verified", timeIndication); counters.Verified++; } break; case ConditionGeneration.Outcome.TimedOut: counters.TimeOuts++; Utilities.IO.Inform("{0}timed out", timeIndication); break; case ConditionGeneration.Outcome.OutOfMemory: counters.OutOfMemories++; Utilities.IO.Inform("{0}out of memory", timeIndication); break; case ConditionGeneration.Outcome.Inconclusive: counters.Inconclusives++; Utilities.IO.Inform("{0}inconclusive", timeIndication); break; case ConditionGeneration.Outcome.Errors: if (CommandLineOptions.Clo.vcVariety == CommandLineOptions.VCVariety.Doomed) { Utilities.IO.Inform("{0}doomed", timeIndication); counters.VerificationErrors++; } Contract.Assert(errors != null); // guaranteed by postcondition of VerifyImplementation // BP1xxx: Parsing errors // BP2xxx: Name resolution errors // BP3xxx: Typechecking errors // BP4xxx: Abstract interpretation errors (Is there such a thing?) // BP5xxx: Verification errors errors.Sort(new CounterexampleComparer()); foreach (Counterexample error in errors) { new GPUVerifyErrorReporter(program, implName).ReportCounterexample(error); counters.VerificationErrors++; } Utilities.IO.Inform("{0}{1}", timeIndication, errors.Count == 1 ? "error" : "errors"); break; } }
// Use this for initialization void Start() { _result = GetComponent <Text>(); _result.text = ResultCounter.GetFrogAResult().ToString(); }
private static ResultCounter VerifyProgram(Program program) { var counters = new ResultCounter(); ConditionGeneration vcgen = null; try { vcgen = new VCGen(program, CommandLineOptions.Clo.SimplifyLogFilePath, CommandLineOptions.Clo.SimplifyLogFileAppend, new List <Checker>()); } catch (ProverException e) { GVUtil.IO.ErrorWriteLine("Fatal Error: ProverException: {0}", e); return(ResultCounter.GetNewCounterWithInternalError()); } // operate on a stable copy, in case it gets updated while we're running var decls = program.TopLevelDeclarations.ToArray(); foreach (Declaration decl in decls) { Contract.Assert(decl != null); int prevAssertionCount = vcgen.CumulativeAssertionCount; Implementation impl = decl as Implementation; if (impl != null && CommandLineOptions.Clo.UserWantsToCheckRoutine(cce.NonNull(impl.Name)) && !impl.SkipVerification) { List <Counterexample /*!*/> /*?*/ errors; DateTime start = new DateTime(); // to please compiler's definite assignment rules if (CommandLineOptions.Clo.Trace) { start = DateTime.UtcNow; if (CommandLineOptions.Clo.Trace) { Console.WriteLine(); Console.WriteLine("Verifying {0} ...", impl.Name); } } VCGen.Outcome outcome; try { outcome = vcgen.VerifyImplementation(impl, out errors); } catch (VCGenException e) { GVUtil.IO.ReportBplError(impl, string.Format("Error BP5010: {0} Encountered in implementation {1}.", e.Message, impl.Name), true, true); errors = null; outcome = VCGen.Outcome.Inconclusive; } catch (UnexpectedProverOutputException upo) { GVUtil.IO.AdvisoryWriteLine("Advisory: {0} SKIPPED because of internal error: unexpected prover output: {1}", impl.Name, upo.Message); errors = null; outcome = VCGen.Outcome.Inconclusive; } string timeIndication = ""; DateTime end = DateTime.UtcNow; TimeSpan elapsed = end - start; if (CommandLineOptions.Clo.Trace) { int poCount = vcgen.CumulativeAssertionCount - prevAssertionCount; timeIndication = string.Format(" [{0:F3} s, {1} proof obligation{2}] ", elapsed.TotalSeconds, poCount, poCount == 1 ? "" : "s"); } KernelAnalyser.ProcessOutcome(program, impl.Name, outcome, errors, timeIndication, ref counters); if (outcome == VCGen.Outcome.Errors || CommandLineOptions.Clo.Trace) { Console.Out.Flush(); } } } vcgen.Close(); cce.NonNull(CommandLineOptions.Clo.TheProverFactory).Close(); GVUtil.IO.WriteTrailer(counters); return(counters); }
private void Start() { couter = GameObject.FindGameObjectWithTag("Player").GetComponent <ResultCounter>(); }