diff --git a/src/test/contracts/set_arithmetic.mligo b/src/test/contracts/set_arithmetic.mligo index 23947077d..86d81fe67 100644 --- a/src/test/contracts/set_arithmetic.mligo +++ b/src/test/contracts/set_arithmetic.mligo @@ -1,4 +1,24 @@ (* Test set operations in CameLIGO *) +let add_op (s : string set) : string set = + Set.add "foobar" s + +let remove_op (s : string set) : string set = + Set.remove "foobar" s + +let remove_deep (s : string set * nat) : string set * nat = + Set.remove "foobar" s.(0) + +(* +let patch_op (s: string set) : string set = + begin patch s with set ["foobar"]; end with s + +let patch_op_deep (s: string set * nat) : string set * nat = + begin patch s.0 with set ["foobar"]; end with s +*) + +let mem_op (s : string set) : bool = + Set.mem "foobar" s + let size_op (s: string set) : nat = Set.size s diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 00530e875..1a25abe00 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -333,7 +333,24 @@ let set_arithmetic_mligo () : unit result = let%bind () = expect_eq program "size_op" (e_set [e_string "foo"; e_string "bar"; e_string "foobar"]) - (e_nat 3) in ok () + (e_nat 3) in + let%bind () = + expect_eq program "add_op" + (e_set [e_string "foo" ; e_string "bar"]) + (e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"]) in + let%bind () = + expect_eq program "add_op" + (e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"]) + (e_set [e_string "foo" ; e_string "bar" ; e_string "foobar"]) in + let%bind () = + expect_eq program "remove_op" + (e_set [e_string "foo" ; e_string "bar"]) + (e_set [e_string "foo" ; e_string "bar"]) in + let%bind () = + 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 + ok () let unit_expression () : unit result = let%bind program = type_file "./contracts/unit.ligo" in