Exemple #1
0
        private void ConstructAndDeriveRegexp(string input, string expectedResult, string removedLetter)
        {
            // Arrange
            regexp = new RegularExpression(input, true);
            Console.Out.WriteLine("{0} optimized into {1}", input, regexp);
            if (expectedResult == null)
            {
                expectedDerivation = null;
            }
            else
            {
                expectedDerivation = new RegularExpression(expectedResult, true);
            }
            Console.Out.WriteLine("{0} optimized into {1}", expectedResult, expectedDerivation);

            // Act
            derivation = regexp.Derive(removedLetter);

            // Assert
            if (expectedDerivation == null)
            {
                Assert.AreEqual(null, derivation);
            }
            else
            {
                Assert.AreEqual(true, expectedDerivation.Equals(derivation));
            }
        }