public void SwitchTest() { Reachability mc = new Reachability(); //mc.ExcludeIsomorphicStates = false; mc.ModelProgram = LibraryModelProgram.Create(typeof(SampleModels.PowerSwitch.Contract)); ReachabilityResult result = mc.CheckReachability(); Assert.AreEqual(result.StateCount, 2, "The state count returned differs from actual..."); Assert.AreEqual(result.TransitionCount, 2, "The transition count returned differs from actual..."); }
public void PowerSwitchTest() { LibraryModelProgram mp = LibraryModelProgram.Create(typeof(SampleModels.PowerSwitch.Contract)); FSMBuilder fabuilder = new FSMBuilder(mp); FSM fsm = fabuilder.Explore(); Assert.AreEqual(2, fsm.AcceptingStates.Count, "Unexpected number of accepting states."); Assert.AreEqual(2, fsm.States.Count, "Unexpected number of states."); Assert.AreEqual(2, fsm.Transitions.Count, "Unexpected number of transitions."); Assert.IsTrue(fsm.IsDeterministic, "FSM expected to be deterministic."); Set <Symbol> voc = new Set <Symbol>(Symbol.Parse("PowerOn"), Symbol.Parse("PowerOff")); Assert.AreEqual(voc, fsm.Vocabulary, "Unexpected vocabulary."); }
public void FanTest2() { LibraryModelProgram mp = LibraryModelProgram.Create(typeof(SampleModels.Fan.Control), "Power", "Control", "Speed", "Filter1"); FSMBuilder fabuilder = new FSMBuilder(mp); FSM fsm = fabuilder.Explore(); Assert.AreEqual(11, fsm.States.Count, "Unexpected number of states."); Assert.AreEqual(20, fsm.Transitions.Count, "Unexpected number of transitions."); Assert.IsTrue(fsm.IsDeterministic, "FSM expected to be deterministic."); Set <Symbol> voc = new Set <Symbol>(Symbol.Parse("PowerOn"), Symbol.Parse("PowerOff"), Symbol.Parse("ControlPower"), Symbol.Parse("ControlSpeed"), Symbol.Parse("IncrementSpeed")); Assert.AreEqual(voc, fsm.Vocabulary, "Unexpected vocabulary."); }
static public ModelProgram Create() { return(LibraryModelProgram.Create(typeof(Program))); }
public static ModelProgram Create() { return(LibraryModelProgram.Create(typeof(Factory))); }
public static ModelProgram Create() { return(LibraryModelProgram.Create(typeof(Contract))); }