public void ComplexTest() { _lexer = new Lexer("x+1.99+1.2"); Assert.That(_lexer._tokens.Count(), Is.EqualTo(6)); _lexer = new Lexer("1.1/2.3*(4.8+2)"); Assert.That(_lexer._tokens.Count(), Is.EqualTo(10)); }
public void BasicTest() { _lexer = new Lexer("1.99+1.2"); Assert.That(_lexer.Current.Value, Is.EqualTo(1.99)); _lexer.MoveNext(); Assert.That(_lexer.Current.TokenType, Is.EqualTo(TokenType.Plus)); _lexer.MoveNext(); Assert.That(_lexer.Current.Value, Is.EqualTo(1.2)); }
internal double Parse(double x, string function) { _lexer = new Lexer(function); _x = x; return Expression(); }