public void TestReverseStartStop() { Automaat <string> automaat = new Automaat <string>(); automaat.DefineAsStartState("0"); automaat.DefineAsFinalState("1"); Automaat <string> reverse = NdfaToDfaConverter.Reverse(automaat); Assert.AreEqual(automaat.StartStates, reverse.FinalStates); Assert.AreEqual(automaat.FinalStates, reverse.StartStates); }
public void TestReverseTransition() { Automaat <string> automaat = new Automaat <string>(); automaat.AddTransition(new Transition <string>("0", 'a', "1")); automaat.AddTransition(new Transition <string>("0", 'b', "1")); automaat.AddTransition(new Transition <string>("1", 'b', "0")); automaat.AddTransition(new Transition <string>("1", 'a', "1")); Automaat <string> reverse = NdfaToDfaConverter.Reverse(automaat); Assert.AreEqual("(0, b)-->1", reverse.Transitions.ToList()[0].ToString()); Assert.AreEqual("(1, a)-->0", reverse.Transitions.ToList()[1].ToString()); Assert.AreEqual("(1, a)-->1", reverse.Transitions.ToList()[2].ToString()); Assert.AreEqual("(1, b)-->0", reverse.Transitions.ToList()[3].ToString()); }