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