public void EnumerateAllStatesOriginalDesign() { var model = Model.CreateOriginal(); var result = ModelChecker.CheckInvariant(model, true); result.FormulaHolds.Should().BeTrue(); }
public void EnumerateAllStates() { var model = new Model(); var result = ModelChecker.CheckInvariant(model, true); result.FormulaHolds.Should().BeTrue(); }
public void TankRupturesShouldBePossible() { var model = new Model(); var result = ModelChecker.CheckInvariant(model, !model.Tank.IsRuptured); result.FormulaHolds.Should().BeFalse(); result.CounterExample.Should().NotBeNull(); result.CounterExample.Save("counter examples/pressure tank/possible tank rupture"); }
public void TankDoesNotRuptureWhenNoFaultsOccurModel() { var model = new Model(); model.Faults.SuppressActivations(); var result = ModelChecker.CheckInvariant(model, !model.Tank.IsRuptured); result.FormulaHolds.Should().BeTrue(); }
public void TimerNeverOpensWhenSensorIsAlwaysWorking() { var model = new Model(); model.Faults.SuppressActivations(); var result = ModelChecker.CheckInvariant(model, !model.Timer.HasElapsed); result.FormulaHolds.Should().BeTrue(); }
public void TrainCanPassUnsecuredCrossing() { var model = new Model(); var result = ModelChecker.CheckInvariant(model, !(model.TrainIsAtCrossing && !model.CrossingIsSecured)); result.FormulaHolds.Should().BeFalse(); result.CounterExample.Should().NotBeNull(); result.CounterExample.Save("counter examples/railroad crossing/train can pass unsecured crossing"); }
public void TrainCanStopBeforeCrossing() { var model = new Model(); var result = ModelChecker.CheckInvariant(model, !(model.Train.Position < Model.CrossingPosition && model.Train.Speed == 0)); result.FormulaHolds.Should().BeFalse(); result.CounterExample.Should().NotBeNull(); result.CounterExample.Save("counter examples/railroad crossing/train can stop before crossing"); }
public void TankDoesNotRuptureWhenNoFaultsOccurLTL() { var model = new Model(); Formula noFaults = !model.Sensor.SuppressIsEmpty.IsActivated && !model.Sensor.SuppressIsFull.IsActivated && !model.Pump.SuppressPumping.IsActivated && !model.Timer.SuppressTimeout.IsActivated; var result = ModelChecker.Check(model, G(noFaults).Implies(!F(model.Tank.IsRuptured))); result.FormulaHolds.Should().BeTrue(); }
public void TimerOpensWhenSensorIsNotWorking() { var model = new Model(); model.Faults.SuppressActivations(); model.Sensor.SuppressIsFull.Activation = Activation.Forced; var result = ModelChecker.CheckInvariant(model, !model.Timer.HasElapsed); result.FormulaHolds.Should().BeFalse(); result.CounterExample.Should().NotBeNull(); result.CounterExample.Save("counter examples/pressure tank/possible timeout"); }
public void TankRupturesWhenSensorDoesNotReportTankFullAndTimerDoesNotTimeout() { var model = new Model(); model.Faults.SuppressActivations(); model.Sensor.SuppressIsFull.Activation = Activation.Forced; model.Timer.SuppressTimeout.Activation = Activation.Forced; var result = ModelChecker.CheckInvariant(model, !model.Tank.IsRuptured); result.FormulaHolds.Should().BeFalse(); result.CounterExample.Should().NotBeNull(); result.CounterExample.Save("counter examples/pressure tank/tank rupture when sensor and timer fail"); }
protected override void CheckIfQueriesWork(Domain domain) { var nodes = new[] { WellKnown.DefaultNodeId, "Node1", "Node2", "Node3", "Node4", "Node5", }; foreach (var node in nodes) { var selectedNode = domain.StorageNodeManager.GetNode(node); using (var session = domain.OpenSession()) using (var transaction = session.OpenTransaction()) { var checker = new ModelChecker(); checker.Run(session); } } }
public void TankDoesNotRuptureWhenSensorDoesNotReportTankFull() { var model = new Model(); model.Faults.SuppressActivations(); model.Sensor.SuppressIsFull.Activation = Activation.Forced; // Setting the fault's activation to Activation.Forced means that it is always activated when it can be activated; // setting it to Activation.Nondeterministic instead allows the fault to be activated nondeterministically. // We use the former since we specifically want to check only those situations in which the fault is activated; // while these situations are obviously also included when Activation.Nondeterministic is used, forced activation // can be checked more efficiently. This optimization is made purely for reasons of illustration, // of course, as the case study is so simple that model checking times are completely irrelevant. var result = ModelChecker.CheckInvariant(model, !model.Tank.IsRuptured); result.FormulaHolds.Should().BeTrue(); }
private void CheckIfQueriesWork(Domain domain) { var nodes = new[] { WellKnown.DefaultNodeId, "Node1", "Node2", "Node3", "Node4", "Node5", }; foreach (var node in nodes) { using (var session = domain.OpenSession()) { session.SelectStorageNode(node); using (var transaction = session.OpenTransaction()) { var populator = new ModelChecker(); populator.Run(session); } } } }
public async Task <bool> ChangesCheckedAndSavedSuccessfully() { ModelChecker.Check(this.ModelState); TempData.CorrectEmptyArrays <int>(); if (CategoryTypeSelection != null) { Category.CategoryType = _context.CategoryTypes.FirstOrDefault(x => x.Id == CategoryTypeSelection); } else { Category.CategoryType = null; } TempData.Clear(); return(await SaveChanges.SavedSuccessfully(this._context, this._context.Categories, this.Category)); }
public async Task <bool> ChangesCheckedAndSavedSuccessfully() { ModelChecker.Check(this.ModelState); TempData.CorrectEmptyArrays <int>(); UpdateJoinTableFromSelectList.Update(_context.BrickCategories, Brick, TempData[nameof(categorySelectionOrig)] as int[], CategorySelect); UpdateJoinTableFromSelectList.Update(_context.BrickToBrick, Brick, TempData[nameof(childrenSelectOrig)] as int[], ChildrenSelect); UpdateJoinTableFromSelectList.Update(_context.BrickToBrick, Brick, TempData[nameof(parentsSelectOrig)] as int[], ParentsSelect, Relationship.Reversed); TempData.Clear(); return(await SaveChanges.SavedSuccessfully(this._context, this._context.Bricks, this.Brick)); /* * _context.Attach(Brick).State = EntityState.Modified; * * try * { * await _context.SaveChangesAsync(); * } * catch (DbUpdateConcurrencyException) * { * if (!_context.Bricks.Any(e => e.Id == Brick.Id)) * { * return false; * } * else * { * throw; * } * * } * return true;*/ }
public void EnumerateAllStates(Model model, string variantName) { var result = ModelChecker.CheckInvariant(model, true); result.FormulaHolds.Should().BeTrue(); }