Example #1
0
        public void EvenZeroesTest()
        {
            var q  = new States(2);
            var f  = new AcceptingStates(q[0]);
            var tf = new TransitionFunction()
            {
                new Transition(q[0], '1', q[0]),
                new Transition(q[0], '0', q[1]),
                new Transition(q[1], '0', q[0]),
                new Transition(q[1], '1', q[1])
            };
            var m = new FiniteAutomaton(q, Alphabet.Binary, tf, q[0], f);

            Assert.True(m.Run("1111"));
            Assert.True(m.Run("1100"));
            Assert.True(m.Run("10101"));
            Assert.True(m.Run("00"));
            Assert.True(m.Run("10111111110"));
            Assert.False(m.Run("101"));
            Assert.False(m.Run("000"));
            Assert.False(m.Run("11111011111"));
        }