Beispiel #1
0
        public void Concat()
        {
            NFA nfa = NFA.Concat(NFA.Char('a'), NFA.Char('b'));
            DFA dfa = nfa.ToDfa();

            Assert.IsFalse(dfa.IsMatch(""));
            Assert.IsFalse(dfa.IsMatch("a"));
            Assert.IsFalse(dfa.IsMatch("b"));
            Assert.IsFalse(dfa.IsMatch("aa"));
            Assert.IsTrue(dfa.IsMatch("ab"));
            Assert.IsFalse(dfa.IsMatch("bb"));
            Assert.IsFalse(dfa.IsMatch("ba"));
            Assert.IsFalse(dfa.IsMatch("aaa"));
            Assert.IsFalse(dfa.IsMatch("aba"));
            Assert.IsFalse(dfa.IsMatch("abb"));
        }