From 557d60d5df5258a29ce964fac1f5ffdc625dcb2a Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Fri, 22 Sep 2023 18:51:45 +0200 Subject: Correction in precedence order --- test/qsp_parser_test.ml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/qsp_parser_test.ml') diff --git a/test/qsp_parser_test.ml b/test/qsp_parser_test.ml index 4665737..ef19ed9 100644 --- a/test/qsp_parser_test.ml +++ b/test/qsp_parser_test.ml @@ -638,6 +638,25 @@ let test_precedence4 () = let test_precedence5 () = _test_instruction "clear()" Ast.[ Call (_position, "CLEAR", []) ] +let test_precedence6 () = + _test_instruction "(1 = 0 and 2 ! 3)" + [ + Ast.Expression + (Ast.BinaryOp + ( _position, + And, + Ast.BinaryOp + ( _position, + Eq, + Ast.Integer (_position, "1"), + Ast.Integer (_position, "0") ), + Ast.BinaryOp + ( _position, + Neq, + Ast.Integer (_position, "2"), + Ast.Integer (_position, "3") ) )); + ] + (** An identifier cannot start by a number *0 is a product and not an identifier *) let test_operator () = @@ -719,6 +738,7 @@ let syntax = Alcotest.test_case "Function rand" `Quick test_function2; Alcotest.test_case "Precedence4" `Quick test_precedence4; Alcotest.test_case "Precedence5" `Quick test_precedence5; + Alcotest.test_case "Precedence6" `Quick test_precedence6; Alcotest.test_case "Operator" `Quick test_operator; Alcotest.test_case "Operator2" `Quick test_operator2; Alcotest.test_case "Dyneval" `Quick test_dyneval; -- cgit v1.2.3