From ddc5b8e36daa873c6cd3387e5912bc22191c6508 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 23 Oct 2019 18:29:49 -0700 Subject: [PATCH] Add failing boolean operator test --- src/test/contracts/boolean_operators.mligo | 16 ++++++++++++++++ src/test/integration_tests.ml | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/test/contracts/boolean_operators.mligo diff --git a/src/test/contracts/boolean_operators.mligo b/src/test/contracts/boolean_operators.mligo new file mode 100644 index 000000000..7939ccf47 --- /dev/null +++ b/src/test/contracts/boolean_operators.mligo @@ -0,0 +1,16 @@ +// Test CameLIGO boolean operators + +let or_true (b : bool) : bool = + b or True + +let or_false (b : bool) : bool = + b or False + +let and_true (b : bool) : bool = + b and True + +let and_false (b : bool) : bool = + b and False + +let not_bool (b: bool) : bool = + not b diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 3160ebf91..e294d1e44 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 _ = @@ -941,6 +954,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 ;