public void TestMethod2() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("5"), "(literal)", "5" ); }
public void TestMethod15() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("1.8e+6"), "(literal)", "1.8e+6" ); }
public void TestMethod1() { MathLexer l = new MathLexer(); List <Token> tokens = new List <Token>(l.Tokenize(" 1234 ")); Assert.AreEqual(1, tokens.Count); Assert.AreEqual("(literal)", tokens[0].Type); Assert.AreEqual("1234", tokens[0].Value); }
public void TestMethod6() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("-1"), "(operator)", "-", "(literal)", "1" ); }
public void TestMethod3() { MathLexer l = new MathLexer(); CheckTokens(l.Tokenize("-3"), "(operator)", "-", "(literal)", "3" ); }
public void TestMethod1() { MathLexer l = new MathLexer(); CheckTokens(l.Tokenize("2 + 3"), "(literal)", "2", "(operator)", "+", "(literal)", "3" ); }
public void TestMethod10() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("-09/03"), "(operator)", "-", "(literal)", "09", "(operator)", "/", "(literal)", "03" ); }
public void TestMethod9() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("90*(-4)"), "(literal)", "90", "(operator)", "*", "(parenthesis)", "(", "(operator)", "-", "(literal)", "4", "(parenthesis)", ")" ); }
public void TestMethod5() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("-2+(-3)"), "(operator)", "-", "(literal)", "2", "(operator)", "+", "(parenthesis)", "(", "(operator)", "-", "(literal)", "3", "(parenthesis)", ")" ); }
public void TestMethod12() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("10-7/(2)"), "(literal)", "10", "(operator)", "-", "(literal)", "7", "(operator)", "/", "(parenthesis)", "(", "(literal)", "2", "(parenthesis)", ")" ); }
public void TestMethod11() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("-09/(-03)"), "(operator)", "-", "(literal)", "09", "(operator)", "/", "(parenthesis)", "(", "(operator)", "-", "(literal)", "03", "(parenthesis)", ")" ); }
public void TestMethod13() { MathLexer lexer = new MathLexer(); CheckTokens(lexer.Tokenize("1.2+6-(-4)"), "(literal)", "1.2", "(operator)", "+", "(literal)", "6", "(operator)", "-", "(parenthesis)", "(", "(operator)", "-", "(literal)", "4", "(parenthesis)", ")" ); }
private void click_Click(object sender, EventArgs e) { try { LexerBox.Text = ""; var lexer = new MathLexer(); var tokens = lexer.Tokenize(TextBox.Text); foreach (var token in tokens) { LexerBox.Text += token + "\r\n"; } } catch { TextBox.Text = "error input"; } }
public void TestMethod2() { MathLexer l = new MathLexer(); List <Token> tokens = new List <Token>(l.Tokenize("12 | 34")); }