diff --git a/src/test/contracts/boolean_operators.mligo b/src/test/contracts/boolean_operators.mligo new file mode 100644 index 000000000..7eb3cfd69 --- /dev/null +++ b/src/test/contracts/boolean_operators.mligo @@ -0,0 +1,16 @@ +// Test CameLIGO boolean operators + +let or_true (b : bool) : bool = + b || true + +let or_false (b : bool) : bool = + b || false + +let and_true (b : bool) : bool = + b && true + +let and_false (b : bool) : bool = + b && false + +let not_bool (b: bool) : bool = + not b diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index ecc69e7b4..cc1ffc134 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -163,6 +163,19 @@ let bool_expression () : unit result = ] in ok () +let bool_expression_mligo () : unit result = + let%bind program = mtype_file "./contracts/boolean_operators.mligo" in + let%bind _ = + let aux (name, f) = expect_eq_b_bool program name f in + bind_map_list aux [ + ("or_true", fun b -> b || true) ; + ("or_false", fun b -> b || false) ; + ("and_true", fun b -> b && true) ; + ("and_false", fun b -> b && false) ; + ("not_bool", fun b -> not b) ; + ] in + ok () + let arithmetic () : unit result = let%bind program = type_file "./contracts/arithmetic.ligo" in let%bind _ = @@ -955,6 +968,7 @@ let main = test_suite "Integration (End to End)" [ test "annotation" annotation ; test "multiple parameters" multiple_parameters ; test "bool" bool_expression ; + test "bool (mligo)" bool_expression_mligo ; test "arithmetic" arithmetic ; test "arithmetic (mligo)" arithmetic_mligo ; test "bitiwse_arithmetic" bitwise_arithmetic ;