Пример #1
0
        public void Parse_WithStarInConcatination_ReturnsExpectedTree()
        {
            // Arrange
            var pattern = "ab*c";

            // Act
            var regex = Regex.Parse(pattern);

            // Assert
            regex.Tree.AssertConcatenation(
                TreeAssert.Char('a'),
                TreeAssert.Concat(
                    TreeAssert.Star(
                        TreeAssert.Char('b')),
                    TreeAssert.Char('c')));
        }
Пример #2
0
        public void Parse_WithOptionalRepeatingGroupedAlternativesInConcatination_ReturnsExpectedTree()
        {
            // Arrange
            var pattern = "a(b|c)*d";

            // Act
            var regex = Regex.Parse(pattern);

            // Assert
            regex.Tree.AssertConcatenation(
                TreeAssert.Char('a'),
                TreeAssert.Concat(
                    TreeAssert.Star(
                        TreeAssert.Alt(
                            TreeAssert.Char('b'),
                            TreeAssert.Char('c'))),
                    TreeAssert.Char('d')));
        }