2019-09-22 01:59:48 +04:00
|
|
|
// Test set type and basic operations in PascaLIGO
|
|
|
|
|
2019-07-19 16:35:47 +04:00
|
|
|
const s_e : set(string) = (set_empty : set(string))
|
|
|
|
|
|
|
|
const s_fb : set(string) = set [
|
|
|
|
"foo" ;
|
|
|
|
"bar" ;
|
|
|
|
]
|
|
|
|
|
|
|
|
function add_op (const s : set(string)) : set(string) is
|
|
|
|
begin skip end with set_add("foobar" , s)
|
|
|
|
|
|
|
|
function remove_op (const s : set(string)) : set(string) is
|
|
|
|
begin skip end with set_remove("foobar" , s)
|
|
|
|
|
2019-10-08 22:54:49 +04:00
|
|
|
// Test the PascaLIGO syntactic sugar for set removal vs. the function call
|
|
|
|
function remove_syntax (var s : set(string)) : set(string) is
|
|
|
|
begin remove "foobar" from set s; end with s
|
|
|
|
|
2019-10-15 02:48:20 +04:00
|
|
|
function remove_deep (var s : set(string) * nat) : set(string) * nat is
|
|
|
|
begin remove "foobar" from set s.0; end with s
|
|
|
|
|
2019-10-10 10:13:25 +04:00
|
|
|
function patch_op (var s: set(string)) : set(string) is
|
|
|
|
begin patch s with set ["foobar"]; end with s
|
|
|
|
|
2019-10-12 00:24:40 +04:00
|
|
|
function patch_op_deep (var s: set(string)*nat) : set(string)*nat is
|
|
|
|
begin patch s.0 with set ["foobar"]; end with s
|
|
|
|
|
2019-07-19 16:35:47 +04:00
|
|
|
function mem_op (const s : set(string)) : bool is
|
|
|
|
begin skip end with set_mem("foobar" , s)
|