From b3993d0db95f2ed6b47659862ae7f9e5eb53d06e Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 25 Oct 2019 17:24:12 -0700 Subject: [PATCH] Add failing negative operator --- src/test/contracts/arithmetic.mligo | 6 ++++++ src/test/integration_tests.ml | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/test/contracts/arithmetic.mligo diff --git a/src/test/contracts/arithmetic.mligo b/src/test/contracts/arithmetic.mligo new file mode 100644 index 000000000..0e5f01587 --- /dev/null +++ b/src/test/contracts/arithmetic.mligo @@ -0,0 +1,6 @@ +// Test CameLIGO arithmetic operators + +let neg_op (n : int) : int = + -n + + diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 09e511322..7c800c63d 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -178,6 +178,15 @@ let arithmetic () : unit result = let%bind () = expect_eq_n_pos program "div_op" e_int (fun n -> e_int (n / 2)) in ok () +let arithmetic_mligo () : unit result = + let%bind program = mtype_file "./contracts/arithmetic.mligo" in + let%bind _ = + let aux (name , f) = expect_eq_n_int program name f in + bind_map_list aux [ + ("neg_op", fun n -> (-n)) ; + ] in + ok () + let bitwise_arithmetic () : unit result = let%bind program = type_file "./contracts/bitwise_arithmetic.ligo" in let%bind () = expect_eq program "or_op" (e_nat 7) (e_nat 7) in @@ -960,6 +969,7 @@ let main = test_suite "Integration (End to End)" [ test "multiple parameters" multiple_parameters ; test "bool" bool_expression ; test "arithmetic" arithmetic ; + test "arithmetic (mligo)" arithmetic_mligo ; test "bitiwse_arithmetic" bitwise_arithmetic ; test "string_arithmetic" string_arithmetic ; test "string_arithmetic (mligo)" string_arithmetic_mligo ;