public void FailureFirst() { IScanner scanner = Provider.NewScanner; SequenceParser parser = new SequenceParser(Second, Second2); ParserMatch m = parser.Parse(scanner); Assert.IsFalse(m.Success); Assert.AreEqual(0, scanner.Offset); }
public void Constructor() { IScanner scanner = Provider.NewScanner; Parser f = First; Parser s = Second; SequenceParser parser = new SequenceParser(f, s); Assert.AreEqual(f, parser.FirstParser); Assert.AreEqual(s, parser.SecondParser); }
public void Success() { IScanner scanner = Provider.NewScanner; SequenceParser parser = new SequenceParser(First, Second); ParserMatch m = parser.Parse(scanner); Assert.IsTrue(m.Success); Assert.AreEqual(m.Offset, 0); Assert.AreEqual(m.Offset + m.Length, scanner.Offset); Assert.AreEqual(First.MatchedString + Second.MatchedString, m.Value); }