add one cameligo test

This commit is contained in:
Galfour 2019-06-12 18:41:29 +00:00
parent 8c934a6fd8
commit 4c833fc7a3
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,10 @@
type action =
| Increment of int
| Decrement of int
let main (p : action) (s : int) : (operation list * int) =
let storage =
match p with
| Increment n -> s + n
| Decrement n -> s - n in
(([] : operation list) , storage)

View File

@ -429,6 +429,16 @@ let super_counter_contract () : unit result =
e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in
expect_eq_n program "main" make_input make_expected expect_eq_n program "main" make_input make_expected
let super_counter_contract_mligo () : unit result =
let%bind program = mtype_file "./contracts/super-counter.mligo" in
let make_input = fun n ->
let action = if n mod 2 = 0 then "Increment" else "Decrement" in
e_pair (e_constructor action (e_int n)) (e_int 42) in
let make_expected = fun n ->
let op = if n mod 2 = 0 then (+) else (-) in
e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in
expect_eq_n program "main" make_input make_expected
let dispatch_counter_contract () : unit result = let dispatch_counter_contract () : unit result =
let%bind program = type_file "./contracts/dispatch-counter.ligo" in let%bind program = type_file "./contracts/dispatch-counter.ligo" in
let make_input = fun n -> let make_input = fun n ->
@ -566,6 +576,7 @@ let main = test_suite "Integration (End to End)" [
test "#include directives" include_ ; test "#include directives" include_ ;
test "counter contract" counter_contract ; test "counter contract" counter_contract ;
test "super counter contract" super_counter_contract ; test "super counter contract" super_counter_contract ;
test "super counter contract" super_counter_contract_mligo ;
test "dispatch counter contract" dispatch_counter_contract ; test "dispatch counter contract" dispatch_counter_contract ;
test "closure" closure ; test "closure" closure ;
test "shared function" shared_function ; test "shared function" shared_function ;