Ejemplo n.º 1
0
        public void RegexToStringShouldCreateSingleCharacterString()
        {
            var regex = new RegexDefinition(
                false,
                new RegexExpressionTerm(
                    new RegexTerm(
                        new RegexFactor(
                            new RegexAtomCharacter(
                                new RegexCharacter('a'))))),
                false);

            Assert.AreEqual("a", regex.ToString());
        }
Ejemplo n.º 2
0
        public void RegexToStringShouldCreateSetString()
        {
            var regex = new RegexDefinition(
                false,
                new RegexExpressionTerm(
                    new RegexTerm(
                        new RegexFactor(
                            new RegexAtomSet(
                                new RegexSet(
                                    false,
                                    new RegexCharacterClass(
                                        new RegexCharacterUnitRange(
                                            new RegexCharacterClassCharacter('a')))))))),
                false);

            Assert.AreEqual("[a]", regex.ToString());
        }
Ejemplo n.º 3
0
        public void RegexToStringShouldCreateNegativeRangeString()
        {
            var regex = new RegexDefinition(
                false,
                new RegexExpressionTerm(
                    new RegexTerm(
                        new RegexFactor(
                            new RegexAtomSet(
                                new RegexSet(
                                    true,
                                    new RegexCharacterClass(
                                        new RegexCharacterRange(
                                            new RegexCharacterClassCharacter('a'),
                                            new RegexCharacterClassCharacter('z')))))))),
                false);

            Assert.AreEqual("[^a-z]", regex.ToString());
        }