From 0eb2b73afa3d930177256f39ef359ca558a69d52 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Thu, 24 Oct 2019 15:27:26 -0700 Subject: [PATCH] Add CameLIGO test function utilizing multiple subroutines --- src/test/contracts/function-shared.mligo | 7 +++++++ src/test/integration_tests.ml | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/test/contracts/function-shared.mligo diff --git a/src/test/contracts/function-shared.mligo b/src/test/contracts/function-shared.mligo new file mode 100644 index 000000000..5fc3e0b29 --- /dev/null +++ b/src/test/contracts/function-shared.mligo @@ -0,0 +1,7 @@ +(* Test use of multiple subroutines in a CameLIGO function *) + +let foo (i: int) : int = i + 20 + +let bar (i: int) : int = i + 50 + +let foobar (i: int) : int = (foo i) + (bar i) diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index cc1ffc134..ba12aed84 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -150,6 +150,14 @@ let shared_function () : unit result = in ok () +let shared_function_mligo () : unit result = + let%bind program = mtype_file "./contracts/function-shared.mligo" in + let%bind () = + let make_expect = fun n -> (2 * n + 70) in + expect_eq_n_int program "foobar" make_expect + in + ok () + let bool_expression () : unit result = let%bind program = type_file "./contracts/boolean_operators.ligo" in let%bind _ = @@ -955,6 +963,7 @@ let main = test_suite "Integration (End to End)" [ test "complex function" complex_function ; test "closure" closure ; test "shared function" shared_function ; + test "shared function (mligo)" shared_function_mligo ; test "higher order" higher_order ; test "variant" variant ; test "variant (mligo)" variant_mligo ;