Exemplo n.º 1
0
        public void TerminalRuleReturnsNothingWhenNotMatched()
        {
            var rule = new TerminalRule(0, 'a');

            var matches = rule.Matches("b", 0).ToList();

            Assert.AreEqual(0, matches.Count);
        }
Exemplo n.º 2
0
        public void TerminalRuleReturns1WhenMatched()
        {
            var rule = new TerminalRule(0, 'a');

            var matches = rule.Matches("a", 0).ToList();

            Assert.AreEqual(1, matches.Single());
        }
Exemplo n.º 3
0
        public void TerminalRuleRespectsOffset()
        {
            var rule = new TerminalRule(0, 'a');

            var matches = rule.Matches("bbbabbb", 3).ToList();

            Assert.AreEqual(1, matches.Count);
            Assert.AreEqual(1, matches.Single());
        }