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 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
|
function main(const p : unit; const s : storage_) : list(operation) * storage_ is
|
||||||
var toto : option (int) := Some(0);
|
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)
|
with ((nil: list(operation)), s)
|
||||||
|
|
||||||
function set_ (var n : int ; var m : storage_) : storage_ is block {
|
function set_ (var n : int ; var m : foo) : foo is block {
|
||||||
m.0[23] := n ;
|
m[23] := n ;
|
||||||
} with m
|
} with m
|
||||||
|
|
||||||
function rm (var m : storage_) : storage_ is block {
|
function rm (var m : foo) : foo is block {
|
||||||
remove 42 from map m.0;
|
remove 42 from map m;
|
||||||
} with 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 get (const m : foo) : option(int) is begin skip end with m[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
|
|
||||||
|
|
||||||
const empty_big_map : big_map(int,int) = big_map end
|
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 ;
|
23 -> 0 ;
|
||||||
42 -> 0 ;
|
42 -> 0 ;
|
||||||
end
|
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_ =
|
let set_ (n : int) (m : foo) : foo = Big_map.update 23 (Some(n)) m
|
||||||
(Map.update 23 (Some(n)) m.(0), ())
|
|
||||||
|
|
||||||
let rm (m : storage_) : storage_ =
|
let rm (m : foo) : foo = Big_map.remove 42 m
|
||||||
(Map.remove 42 m.(0), ())
|
|
||||||
|
|
||||||
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 =
|
let get (m: foo): int option = Big_map.find_opt 42 m
|
||||||
Map.find_opt 42 m.(0)
|
|
||||||
|
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 ez lst =
|
||||||
let open Ast_simplified.Combinators in
|
let open Ast_simplified.Combinators in
|
||||||
let lst' = List.map (fun (x, y) -> e_int x, e_int y) lst 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
|
in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let make_input = fun n -> ez [(23, n) ; (42, 4)] in
|
let make_input = fun n -> ez [(23, n) ; (42, 4)] in
|
||||||
|
Loading…
Reference in New Issue
Block a user