public void TestBasicsLiteralStringFail() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("bca", parser.LiteralString); Assert.IsFalse(match.Success); }
public void TestBasicsAndLiteralFail2() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("b", parser.AndLiteral); Assert.IsFalse(match.Success); }
public void TestBasicsAndString() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("abcde", parser.AndString); Assert.IsTrue(match.Success); Assert.AreEqual(4, match.NextIndex); }
public void TestBasicsOrLiteral2() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("ab", parser.OrLiteral); Assert.IsTrue(match.Success); Assert.AreEqual(1, match.NextIndex); }
// left over from an old way of doing things MatchResult <char, int> Run(IEnumerable <char> input, string productionName) { var parser = new MatcherTestsParser(); var production = (Action <MatchState <char, int>, int, IEnumerable <MatchItem <char, int> > >) Delegate.CreateDelegate(typeof(Action <MatchState <char, int>, int, IEnumerable <MatchItem <char, int> > >), parser, productionName); return(parser.GetMatch(input, production)); }
public void TestBasicsCallAct() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("a", parser.CallAct); Assert.IsTrue(match.Success); Assert.AreNotEqual(42, match.Result); }
public void TestBasicsLiteralString() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("abcd", parser.LiteralString); Assert.IsTrue(match.Success); Assert.AreEqual(0, match.StartIndex); Assert.AreEqual(3, match.NextIndex); }
public void TestBasicsAndLiteral() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("ab", parser.AndLiteral); Assert.IsTrue(match.Success); Assert.AreEqual(0, match.StartIndex); Assert.AreEqual(2, match.NextIndex); }
public void TestBasicsOrLiteral() { var parser = new MatcherTestsParser(); var match = parser.GetMatch("a", parser.OrLiteral); Assert.IsTrue(match.Success); parser = new MatcherTestsParser(); match = parser.GetMatch("b", parser.OrLiteral); Assert.IsTrue(match.Success); }
// left over from an old way of doing things MatchResult<char, int> Run(IEnumerable<char> input, string productionName) { var parser = new MatcherTestsParser(); var production = (Action<MatchState<char, int>, int, IEnumerable<MatchItem<char, int>>>) Delegate.CreateDelegate(typeof(Action<MatchState<char, int>, int, IEnumerable<MatchItem<char, int>>>), parser, productionName); return parser.GetMatch(input, production); }