public void testConsume() { Lexer lexer = new Lexer("123"); lexer.consume(2); Assert.IsTrue(lexer.consumeIf("3")); Assert.IsTrue(lexer.eof()); }
public void testConsumeIf() { Lexer lexer = new Lexer("abcd"); Assert.IsFalse(lexer.consumeIf("xab")); Assert.IsTrue(lexer.consumeIf("ab")); Assert.IsFalse(lexer.consumeIf("ycd")); Assert.IsTrue(lexer.consumeIf("cd")); Assert.IsTrue(lexer.eof()); }