@Test
public void testLogical() {

  Parser<Expression> parser = ExpressionParser.logical(NUMBER);
  TerminalParserTest.assertParser(parser, "1", number(1));
  TerminalParserTest.assertParser(parser, "(1)", number(1));
  TerminalParserTest.assertParser(parser, "((1))", number(1));
  TerminalParserTest.assertParser(parser, "not 1", new UnaryExpression(Op.NOT, number(1)));
  TerminalParserTest.assertParser(parser, "1 and 2", new BinaryExpression(number(1), Op.AND, number(2)));
  TerminalParserTest.assertParser(parser, "1 or 2", new BinaryExpression(number(1), Op.OR, number(2)));
  TerminalParserTest.assertParser(parser, "1 or 2 and 3", new BinaryExpression(number(1), Op.OR,
      new BinaryExpression(number(2), Op.AND, number(3))));
  TerminalParserTest.assertParser(parser, "1 or NOT 2", new BinaryExpression(number(1), Op.OR,
      new UnaryExpression(Op.NOT, number(2))));
  TerminalParserTest.assertParser(parser, "not 1 and 2", new BinaryExpression(
      new UnaryExpression(Op.NOT, number(1)), Op.AND, number(2)));
}