Add test for CameLIGO set fold

This commit is contained in:
John David Pressman 2019-10-29 21:33:48 -07:00
parent 85345387d0
commit 27b7527f18
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// Test set iteration
let aggregate (i : int) (j : int) : int = i + j
let fold_op (s : int set) : int =
Set.fold s 15 aggregate

View File

@ -330,6 +330,7 @@ let set_arithmetic () : unit result =
let set_arithmetic_mligo () : unit result =
let%bind program = mtype_file "./contracts/set_arithmetic.mligo" in
let%bind program_1 = type_file "./contracts/set_arithmetic-1.ligo" in
let%bind () =
expect_eq program "size_op"
(e_set [e_string "foo"; e_string "bar"; e_string "foobar"])
@ -350,6 +351,11 @@ let set_arithmetic_mligo () : unit result =
expect_eq program "remove_op"
(e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"])
(e_set [e_string "foo" ; e_string "bar"]) in
let%bind () =
expect_eq program_1 "fold_op"
(e_set [ e_int 4 ; e_int 10 ])
(e_int 29)
in
ok ()
let unit_expression () : unit result =