public void EvaluatorGetLine() { var tokens = new List <IToken> { new Token("2000") }; ProgramLine programLine = new ProgramLine(30, tokens); var result = programLine.GetLineNumber(); Assert.AreEqual(2000, result); }
public void EvaluatorGetLineThrowsExceptionOnBadLineNumber() { var tokens = new List <IToken> { new Token("20X00") }; ProgramLine programLine = new ProgramLine(30, tokens); var result = programLine.GetLineNumber(); Assert.IsNull(result); Assert.AreEqual("20X00", programLine.NextToken().Text); }
public void EvaluatorGetLineReturnsNullAndTokenIsNotEaten() { var tokens = new List <IToken> { new Token("DATA", TokenClass.Statement, TokenType.Data) }; ProgramLine programLine = new ProgramLine(30, tokens); var result = programLine.GetLineNumber(); Assert.AreEqual(null, result); Assert.AreEqual("DATA", programLine.NextToken().Text); }