private void CheckReadCurrentIf( String str, TokenType expectedType, Token expectedResult, Token expectedCurrent, String message) { OperandLexer lexer = MakeFrom(str); lexer.MoveNext(); Token actualResult = lexer.ReadCurrentIf(expectedType); TokenTest.Check(expectedResult, actualResult, "Result: " + message); CheckCurrentToken(expectedCurrent, lexer, "Current: " + message); }
private void CheckMoveNextOne(OperandLexer lexer, Token expected, String message) { try { lexer.MoveNext(); Token actual = lexer.CurrentToken; Assert.IsNotNull(expected, message); TokenTest.Check(expected, actual, message); } catch (Casl2SimulatorException) { Assert.IsNull(expected, message); } }
private void CheckReadCurrentAs( String str, TokenType expectedType, Boolean success, Token expectedResult, Token expectedCurrent, String message) { OperandLexer lexer = MakeFrom(str); lexer.MoveNext(); try { Token actualResult = lexer.ReadCurrentAs(expectedType); Assert.IsTrue(success, message); TokenTest.Check(expectedResult, actualResult, "Result: " + message); CheckCurrentToken(expectedCurrent, lexer, "Current: " + message); } catch (Casl2SimulatorException) { Assert.IsFalse(success, message); } }
private void CheckCurrentToken(Token expected, OperandLexer lexer, String message) { Token actual = lexer.CurrentToken; TokenTest.Check(expected, actual, message); }