updating tests (we don't need the big_map to be in a pair anymore)
This commit is contained in:
parent
2a2c708b54
commit
e6ee915f1e
@ -1,4 +1,5 @@
|
||||
type storage_ is big_map(int, int) * unit
|
||||
type foo is big_map(int, int)
|
||||
|
||||
function main(const p : unit; const s : storage_) : list(operation) * storage_ is
|
||||
var toto : option (int) := Some(0);
|
||||
@ -8,28 +9,28 @@ function main(const p : unit; const s : storage_) : list(operation) * storage_ i
|
||||
}
|
||||
with ((nil: list(operation)), s)
|
||||
|
||||
function set_ (var n : int ; var m : storage_) : storage_ is block {
|
||||
m.0[23] := n ;
|
||||
function set_ (var n : int ; var m : foo) : foo is block {
|
||||
m[23] := n ;
|
||||
} with m
|
||||
|
||||
function rm (var m : storage_) : storage_ is block {
|
||||
remove 42 from map m.0;
|
||||
function rm (var m : foo) : foo is block {
|
||||
remove 42 from map m;
|
||||
} with m
|
||||
|
||||
function gf (const m : storage_) : int is begin skip end with get_force(23, m.0)
|
||||
function gf (const m : foo) : int is begin skip end with get_force(23, m)
|
||||
|
||||
function get (const m : storage_) : option(int) is begin skip end with m.0[42]
|
||||
|
||||
function mutimaps (const m : storage_; const n : storage_) : storage_ is block
|
||||
{
|
||||
var foo : big_map(int,int) := m.0 ;
|
||||
foo[42] := 0 ;
|
||||
n.0[42] := get_force(42, foo) ;
|
||||
} with n
|
||||
function get (const m : foo) : option(int) is begin skip end with m[42]
|
||||
|
||||
const empty_big_map : big_map(int,int) = big_map end
|
||||
|
||||
const map1 : big_map(int,int) = big_map
|
||||
const big_map1 : big_map(int,int) = big_map
|
||||
23 -> 0 ;
|
||||
42 -> 0 ;
|
||||
end
|
||||
|
||||
function mutimaps (const m : foo ; const n : foo) : foo is block
|
||||
{
|
||||
var bar : foo := m ;
|
||||
bar[42] := 0 ;
|
||||
n[42] := get_force(42, bar) ;
|
||||
} with n
|
@ -1,12 +1,21 @@
|
||||
type storage_ = ((int, int) big_map * unit)
|
||||
type foo = (int, int) big_map
|
||||
|
||||
let set_ (n : int) (m : storage_) : storage_ =
|
||||
(Map.update 23 (Some(n)) m.(0), ())
|
||||
let set_ (n : int) (m : foo) : foo = Big_map.update 23 (Some(n)) m
|
||||
|
||||
let rm (m : storage_) : storage_ =
|
||||
(Map.remove 42 m.(0), ())
|
||||
let rm (m : foo) : foo = Big_map.remove 42 m
|
||||
|
||||
let gf (m : storage_) : int = Map.find 23 m.(0)
|
||||
let gf (m : foo) : int = Big_map.find 23 m
|
||||
|
||||
let get (m: storage_): int option =
|
||||
Map.find_opt 42 m.(0)
|
||||
let get (m: foo): int option = Big_map.find_opt 42 m
|
||||
|
||||
let empty_map : foo = Big_map.empty
|
||||
|
||||
let map1 : foo = Big_map.literal
|
||||
[ (23 , 0) ; (42, 0) ]
|
||||
|
||||
let map1 : foo = Big_map.literal
|
||||
[ (23 , 0) ; (42, 0) ]
|
||||
|
||||
let mutimaps (m : foo) (n : foo) : foo =
|
||||
let bar : foo = Big_map.update 42 (Some(0)) m in
|
||||
Big_map.update 42 (get(bar)) n
|
@ -522,7 +522,7 @@ let big_map_ type_f path : unit result =
|
||||
let ez lst =
|
||||
let open Ast_simplified.Combinators in
|
||||
let lst' = List.map (fun (x, y) -> e_int x, e_int y) lst in
|
||||
e_pair (e_typed_big_map lst' t_int t_int) (e_unit ())
|
||||
(e_typed_big_map lst' t_int t_int)
|
||||
in
|
||||
let%bind () =
|
||||
let make_input = fun n -> ez [(23, n) ; (42, 4)] in
|
||||
|
Loading…
Reference in New Issue
Block a user