public void CheckForAnCorrectInput() { var oneOrMore = new OneOrMore(new Character('a')); Assert.True(oneOrMore.Match("abc").IsSuccesful()); Assert.False(oneOrMore.Match("bc").IsSuccesful()); }
public void TheTextNotMatchExactly() { var oneOrMore = new OneOrMore(new Text("ab")); Assert.False(oneOrMore.Match("acb").IsSuccesful()); Assert.Equal("acb", oneOrMore.Match("acb").RemainingText()); }
public void NotContaintTheChar() { var oneOrMore = new OneOrMore(new Character('a')); Assert.False(oneOrMore.Match("zx").IsSuccesful()); Assert.Equal("zx", oneOrMore.Match("zx").RemainingText()); }
public void CheckIfWorkForMoreText() { var oneOrMore = new OneOrMore(new Text("ab")); Assert.Equal("c", oneOrMore.Match("ababc").RemainingText()); Assert.Equal("c", oneOrMore.Match("abababc").RemainingText()); }
public void CheckForEmptyString() { var oneOrMore = new OneOrMore(new Character('a')); Assert.False(oneOrMore.Match("").IsSuccesful()); Assert.Equal("", oneOrMore.Match("").RemainingText()); }
public void CheckIfWorkWithMoreCharInARow() { var oneOrMore = new OneOrMore(new Character('a')); Assert.True(oneOrMore.Match("aabc").IsSuccesful()); Assert.Equal("bc", oneOrMore.Match("aabc").RemainingText()); }
public String() { IPattern hexadecimal = new Sequance(new Character('u'), new Many(new Any("123456789ABCDEFabcdef"), 4, 4)); IPattern controlChar = new OneOrMore(new Sequance(new Character('\\'), new Choice(new Any("\"\\/bfnrt"), hexadecimal))); IPattern unicodeCharacter = new OneOrMore(new Choice(new Range(' ', '!'), new Range('#', '['), new Range(']', Convert.ToChar(65535)))); stringFormat = new Sequance(new Character('\"'), new Many(new Choice(controlChar, unicodeCharacter)), new Character('\"')); }