private ExplorationResult GetLastResultImpl() { Contract.Requires(this.LastResultKind != null); if (this.lastResult == null) { switch (this.LastResultKind.Value) { case ExplorationResultKind.Unknown: this.lastResult = ExplorationResult.CreateUnknown(); break; case ExplorationResultKind.Unreachable: var counterExample = this.CreatePathCounterExample(); this.lastResult = ExplorationResult.CreateUnreachable(counterExample); break; case ExplorationResultKind.Reachable: default: Contract.Assert(this.LastResultKind.Value == ExplorationResultKind.Reachable); var executionModel = this.CreateExecutionModel(); this.lastResult = ExplorationResult.CreateReachable(executionModel); break; } } return(this.lastResult); }
public ExplorationResultKind Solve(Path path) { Contract.Requires(path != null); this.pathConditionHandler.Update(path); Contract.Assert(this.Path == path); var heap = this.pathConditionHandler.Heap; SolverResult solverResult; if (!heap.CanBeSatisfiable) { solverResult = SolverResult.Unsat; } else { var heapAssumptions = heap.GetAssumptions(); if (heapAssumptions.Length > 0) { solverResult = this.smtSolver.Solve(this.pathConditionHandler.NameProvider, heapAssumptions); } else { solverResult = this.smtSolver.Solve(); } } switch (solverResult) { case SolverResult.Sat: this.LastResultKind = ExplorationResultKind.Reachable; break; case SolverResult.Unsat: this.LastResultKind = ExplorationResultKind.Unreachable; break; case SolverResult.Unknown: default: Contract.Assert(solverResult == SolverResult.Unknown); this.LastResultKind = ExplorationResultKind.Unknown; break; } // Force to recreate it next time this.lastResult = null; // TODO: Turn back to Contract.Ensures when possible Contract.Assert(this.Path == path); Contract.Assert(this.LastResultKind != null); return(this.LastResultKind.Value); }
private void ExplorerResultCallback(ExplorationResult result) { // TODO: Implement locking or some intelligent sequencing when multiple explorers are implemented if (result?.ExecutionModel != null) { this.executionModels.Add(result.ExecutionModel); this.executionModelsSubject.OnNext(result.ExecutionModel); } else if (result?.PathCounterExample != null) { // TODO } }