Beispiel #1
0
        public void UseOneOrMoreClassWithSequenceOnAGivenStringReturnFalse()
        {
            var oneOrMore = new OneOrMore(new Sequence(
                                              new Character('u'),
                                              new Range('0', '9'),
                                              new Range('0', '9')));

            Assert.False(oneOrMore.Match("1u12b").Success());
        }
Beispiel #2
0
        public void UseOneOrMoreClassWithSequenceOnAGivenStringReturnFullText()
        {
            var oneOrMore = new OneOrMore(new Sequence(
                                              new Character('u'),
                                              new Range('0', '9'),
                                              new Range('0', '9')));

            Assert.Equal("1u12b", oneOrMore.Match("1u12b").RemainingText());
        }
Beispiel #3
0
        public void UseListMethodWithComplexStringReturnRemainingText()
        {
            var digits     = new OneOrMore(new Range('0', '9'));
            var whitespace = new Many(new Any(" \r\n\t"));
            var separator  = new Sequence(whitespace, new Character(';'), whitespace);
            var list       = new List(digits, separator);

            Assert.Equal("", list.Match("1; 22;\n 333 \t; 22").RemainingText());
        }
Beispiel #4
0
        public void UseOneOrMoreClassWithRangeOnAGivenStringReturnRemainingText()
        {
            var oneOrMore = new OneOrMore(new Range('0', '9'));

            Assert.Equal("ab", oneOrMore.Match("123ab").RemainingText());
        }
Beispiel #5
0
        public void UseOneOrMoreClassWithCharacterOnAGivenStringReturnFalse()
        {
            var oneOrMore = new OneOrMore(new Character('a'));

            Assert.False(oneOrMore.Match("baaab").Success());
        }
Beispiel #6
0
        public void UseOneOrMoreClassWithCharacterOnAGivenStringReturnRemainingText()
        {
            var oneOrMore = new OneOrMore(new Character('a'));

            Assert.Equal("b", oneOrMore.Match("aaab").RemainingText());
        }