/// <summary> /// Initializes a new instance. /// </summary> /// <param name="exception">The unhandled exception that was thrown during model checkinig.</param> /// <param name="counterExample">The path through the model that leads to the <paramref name="exception" /> being thrown.</param> public AnalysisException(Exception exception, CounterExample counterExample) : base($"Error: An unhandled exception of type '{exception.GetType().FullName}' was " + $"thrown during model checking: {exception.Message}", exception) { Requires.NotNull(exception, nameof(exception)); CounterExample = counterExample; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="counterExample">The counter example that should be simulated.</param> public Simulator(CounterExample counterExample) { Requires.NotNull(counterExample, nameof(counterExample)); _counterExample = counterExample; _runtimeModel = counterExample.RuntimeModel; Reset(); }
protected void SimulateCounterExample(CounterExample counterExample, Action<Simulator> action) { // Test directly action(new Simulator(counterExample)); // Test persisted using (var file = new TemporaryFile(".ssharp")) { counterExample.Save(file.FilePath); action(new Simulator(CounterExample.Load(file.FilePath))); } }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="result">The result of the analysis</param> /// <param name="firstFault">The fault that must be activated first.</param> /// <param name="secondFault">The fault that must be activated subsequently.</param> /// <param name="kind">Determines the kind of the order relationship.</param> internal OrderRelationship(AnalysisResult result, Fault firstFault, Fault secondFault, OrderRelationshipKind kind) { Requires.NotNull(result, nameof(result)); Requires.NotNull(firstFault, nameof(firstFault)); Requires.NotNull(secondFault, nameof(secondFault)); Requires.InRange(kind, nameof(kind)); Witness = result.CounterExample; FirstFault = firstFault; SecondFault = secondFault; Kind = kind; }
public override void WriteInternalStateStructure(CounterExample <SafetySharpRuntimeModel> counterExample, BinaryWriter writer) { var formatter = new BinaryFormatter(); var memoryStream = new MemoryStream(); formatter.Serialize(memoryStream, counterExample.RuntimeModel.StateVectorLayout.ToArray()); var metadata = memoryStream.ToArray(); writer.Write(metadata.Length); writer.Write(metadata); }
public SafetySharpSimulator(CounterExample <SafetySharpRuntimeModel> counterExample) : base(counterExample) { }