예제 #1
0
        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...");
        }
예제 #2
0
        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.");
        }
예제 #3
0
        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.");
        }
예제 #4
0
파일: Model.cs 프로젝트: rassilon/NModel
 static public ModelProgram Create()
 {
     return(LibraryModelProgram.Create(typeof(Program)));
 }
예제 #5
0
 public static ModelProgram Create()
 {
     return(LibraryModelProgram.Create(typeof(Factory)));
 }
예제 #6
0
 public static ModelProgram Create()
 {
     return(LibraryModelProgram.Create(typeof(Contract)));
 }