Exemple #1
0
        public void TerminalRuleReturnsNothingWhenNotMatched()
        {
            var rule = new TerminalRule(0, 'a');

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

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

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

            Assert.AreEqual(1, matches.Single());
        }
Exemple #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());
        }