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()); }
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()); }
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()); }