Add test for CameLIGO set fold
This commit is contained in:
parent
85345387d0
commit
27b7527f18
6
src/test/contracts/set_arithmetic-1.mligo
Normal file
6
src/test/contracts/set_arithmetic-1.mligo
Normal 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
|
@ -330,6 +330,7 @@ let set_arithmetic () : unit result =
|
|||||||
|
|
||||||
let set_arithmetic_mligo () : unit result =
|
let set_arithmetic_mligo () : unit result =
|
||||||
let%bind program = mtype_file "./contracts/set_arithmetic.mligo" in
|
let%bind program = mtype_file "./contracts/set_arithmetic.mligo" in
|
||||||
|
let%bind program_1 = type_file "./contracts/set_arithmetic-1.ligo" in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
expect_eq program "size_op"
|
expect_eq program "size_op"
|
||||||
(e_set [e_string "foo"; e_string "bar"; e_string "foobar"])
|
(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"
|
expect_eq program "remove_op"
|
||||||
(e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"])
|
(e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"])
|
||||||
(e_set [e_string "foo" ; e_string "bar"]) in
|
(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 ()
|
ok ()
|
||||||
|
|
||||||
let unit_expression () : unit result =
|
let unit_expression () : unit result =
|
||||||
|
Loading…
Reference in New Issue
Block a user