Merge branch 'feature/set-size-operator' into 'dev'
Add set size op for CameLIGO See merge request ligolang/ligo!150
This commit is contained in:
commit
d0553ffee4
@ -154,6 +154,7 @@ module Simplify = struct
|
||||
("Set.add" , "SET_ADD") ;
|
||||
("Set.remove" , "SET_REMOVE") ;
|
||||
("Set.fold" , "SET_FOLD") ;
|
||||
("Set.size", "SIZE") ;
|
||||
|
||||
("Map.find_opt" , "MAP_FIND_OPT") ;
|
||||
("Map.find" , "MAP_FIND") ;
|
||||
|
@ -31,6 +31,3 @@ function patch_op_empty (var s: set(string)) : set(string) is
|
||||
|
||||
function mem_op (const s : set(string)) : bool is
|
||||
begin skip end with set_mem("foobar" , s)
|
||||
|
||||
|
||||
|
||||
|
4
src/test/contracts/set_arithmetic.mligo
Normal file
4
src/test/contracts/set_arithmetic.mligo
Normal file
@ -0,0 +1,4 @@
|
||||
(* Test set operations in CameLIGO *)
|
||||
|
||||
let size_op (s: string set) : nat =
|
||||
Set.size s
|
@ -295,6 +295,13 @@ let set_arithmetic () : unit result =
|
||||
in
|
||||
ok ()
|
||||
|
||||
let set_arithmetic_mligo () : unit result =
|
||||
let%bind program = mtype_file "./contracts/set_arithmetic.mligo" in
|
||||
let%bind () =
|
||||
expect_eq program "size_op"
|
||||
(e_set [e_string "foo"; e_string "bar"; e_string "foobar"])
|
||||
(e_nat 3) in ok ()
|
||||
|
||||
let unit_expression () : unit result =
|
||||
let%bind program = type_file "./contracts/unit.ligo" in
|
||||
expect_eq_evaluate program "u" (e_unit ())
|
||||
@ -936,6 +943,7 @@ let main = test_suite "Integration (End to End)" [
|
||||
test "string_arithmetic (mligo)" string_arithmetic_mligo ;
|
||||
test "bytes_arithmetic" bytes_arithmetic ;
|
||||
test "set_arithmetic" set_arithmetic ;
|
||||
test "set_arithmetic (mligo)" set_arithmetic_mligo ;
|
||||
test "unit" unit_expression ;
|
||||
test "string" string_expression ;
|
||||
test "option" option ;
|
||||
|
Loading…
Reference in New Issue
Block a user