public void GetTokens() { List <MathToken> tokens = _lexer.GetTokens("2 + 2"); Assert.AreEqual(3, tokens.Count); Assert.AreEqual("2", tokens[0].Token); Assert.AreEqual("+", tokens[1].Token); Assert.AreEqual("2", tokens[2].Token); }
public void GetMaxPrecedence() { List <MathToken> tokens = _lexer.GetTokens("3 + 3 * 2"); MathToken token = _precedence.GetMaxPrecedence(tokens); MathOperator op = OperatorFactory.Create(token.Token); Assert.AreEqual(op.Token, "*"); }