@Test
public void testArithmetic() {

  Parser<Expression> parser = ExpressionParser.arithmetic(NUMBER);
  TerminalParserTest.assertParser(parser, "1", number(1));
  TerminalParserTest.assertParser(parser, "((1))", number(1));
  TerminalParserTest.assertParser(parser, "1 + 2", new BinaryExpression(number(1), Op.PLUS, number(2)));
  TerminalParserTest.assertParser(parser, "2 * (1 + (2))",
      new BinaryExpression(number(2), Op.MUL,
          new BinaryExpression(number(1), Op.PLUS, number(2))));
  TerminalParserTest.assertParser(parser, "2 - 1 / (2)",
      new BinaryExpression(number(2), Op.MINUS,
          new BinaryExpression(number(1), Op.DIV, number(2))));
  TerminalParserTest.assertParser(parser, "2 * 1 % -2",
      new BinaryExpression(
          new BinaryExpression(number(2), Op.MUL, number(1)),
              Op.MOD, new UnaryExpression(Op.NEG, number(2))));
  TerminalParserTest.assertParser(parser, "f(1)", FunctionExpression.of(QualifiedName.of("f"), number(1)));
  TerminalParserTest.assertParser(parser, "foo.bar(1, 2) + baz(foo.bar(1 / 2))",
      new BinaryExpression(
          FunctionExpression.of(QualifiedName.of("foo", "bar"), number(1), number(2)),
          Op.PLUS,
          FunctionExpression.of(QualifiedName.of("baz"),
              FunctionExpression.of(QualifiedName.of("foo", "bar"), new BinaryExpression(
                  number(1), Op.DIV, number(2))))));
}