diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 32b26dbd2..d6364e2c5 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -208,12 +208,12 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig %left T_LOCAL T_RETURN %left T_IDENTIFIER %left T_SET T_SET_ADD T_SET_SUBTRACT T_SET_MULTIPLY T_SET_DIVIDE T_SET_MODULO T_SET_XOR T_SET_BINARY_AND T_SET_BINARY_OR +%nonassoc T_EQUAL T_NOT_EQUAL +%nonassoc T_LESS_THAN T_LESS_THAN_OR_EQUAL T_GREATER_THAN T_GREATER_THAN_OR_EQUAL %left T_BINARY_OR %left T_XOR T_MODULO %left T_BINARY_AND %left T_IN T_NOT_IN -%nonassoc T_EQUAL T_NOT_EQUAL -%nonassoc T_LESS_THAN T_LESS_THAN_OR_EQUAL T_GREATER_THAN T_GREATER_THAN_OR_EQUAL %left T_SHIFT_LEFT T_SHIFT_RIGHT %left T_PLUS T_MINUS %left T_MULTIPLY T_DIVIDE_OP diff --git a/test/config-ops.cpp b/test/config-ops.cpp index f2bacebef..bb0e3b20f 100644 --- a/test/config-ops.cpp +++ b/test/config-ops.cpp @@ -262,6 +262,46 @@ BOOST_AUTO_TEST_CASE(advanced) expr = ConfigCompiler::CompileText("", "typeof(\"test\") == String"); BOOST_CHECK(expr->Evaluate(frame)); delete expr; + + expr = ConfigCompiler::CompileText("", "7 | 8 == 15"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 ^ 8 == 15"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 & 15 == 7"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 in [7] == true"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 !in [7] == false"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 | 8 > 14"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 ^ 8 > 14"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 & 15 > 6"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 in [7] > 0"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; + + expr = ConfigCompiler::CompileText("", "7 !in [7] > -1"); + BOOST_CHECK(expr->Evaluate(frame)); + delete expr; } BOOST_AUTO_TEST_SUITE_END()