Updated tests
This commit is contained in:
@@ -8,7 +8,7 @@ contract AbortTest =
|
||||
{ value = v }
|
||||
|
||||
// Aborting
|
||||
public function do_abort(v : int, s : string) : () =
|
||||
public function do_abort(v : int, s : string) : unit =
|
||||
put_value(v)
|
||||
revert_abort(s)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
contract Interface =
|
||||
function do_abort : (int, string) => ()
|
||||
function do_abort : (int, string) => unit
|
||||
function get_value : () => int
|
||||
function put_value : (int) => ()
|
||||
function put_value : (int) => unit
|
||||
function get_values : () => list(int)
|
||||
function put_values : (int) => ()
|
||||
function put_values : (int) => unit
|
||||
|
||||
contract AbortTestInt =
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
contract Remote =
|
||||
entrypoint main : (int) => ()
|
||||
entrypoint main : (int) => unit
|
||||
|
||||
contract AddrChain =
|
||||
type o_type = oracle(string, map(string, int))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
contract Remote =
|
||||
entrypoint foo : () => ()
|
||||
entrypoint foo : () => unit
|
||||
|
||||
contract AddressLiterals =
|
||||
entrypoint addr() : address =
|
||||
|
||||
@@ -12,44 +12,44 @@ contract AENSTest =
|
||||
// Transactions
|
||||
|
||||
stateful entrypoint preclaim(addr : address, // Claim on behalf of this account (can be Contract.address)
|
||||
chash : hash) : () = // Commitment hash
|
||||
chash : hash) : unit = // Commitment hash
|
||||
AENS.preclaim(addr, chash)
|
||||
|
||||
stateful entrypoint signedPreclaim(addr : address, // Claim on behalf of this account (can be Contract.address)
|
||||
chash : hash, // Commitment hash
|
||||
sign : signature) : () = // Signed by addr (if not Contract.address)
|
||||
sign : signature) : unit = // Signed by addr (if not Contract.address)
|
||||
AENS.preclaim(addr, chash, signature = sign)
|
||||
|
||||
stateful entrypoint claim(addr : address,
|
||||
name : string,
|
||||
salt : int) : () =
|
||||
salt : int) : unit =
|
||||
AENS.claim(addr, name, salt)
|
||||
|
||||
stateful entrypoint signedClaim(addr : address,
|
||||
name : string,
|
||||
salt : int,
|
||||
sign : signature) : () =
|
||||
sign : signature) : unit =
|
||||
AENS.claim(addr, name, salt, signature = sign)
|
||||
|
||||
// TODO: update() -- how to handle pointers?
|
||||
|
||||
stateful entrypoint transfer(owner : address,
|
||||
new_owner : address,
|
||||
name : string) : () =
|
||||
name : string) : unit =
|
||||
AENS.transfer(owner, new_owner, name)
|
||||
|
||||
stateful entrypoint signedTransfer(owner : address,
|
||||
new_owner : address,
|
||||
name : string,
|
||||
sign : signature) : () =
|
||||
sign : signature) : unit =
|
||||
AENS.transfer(owner, new_owner, name, signature = sign)
|
||||
|
||||
stateful entrypoint revoke(owner : address,
|
||||
name : string) : () =
|
||||
name : string) : unit =
|
||||
AENS.revoke(owner, name)
|
||||
|
||||
stateful entrypoint signedRevoke(owner : address,
|
||||
name : string,
|
||||
sign : signature) : () =
|
||||
sign : signature) : unit =
|
||||
AENS.revoke(owner, name, signature = sign)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ contract AllSyntax =
|
||||
if(valWithType(Map.empty) == None)
|
||||
print(42 mod 10 * 5 / 3)
|
||||
|
||||
function funWithType(x : int, y) : (int, list(int)) = (x, 0 :: [y] ++ [])
|
||||
function funWithType(x : int, y) : int * list(int) = (x, 0 :: [y] ++ [])
|
||||
function funNoType() =
|
||||
let foo = (x, y : bool) =>
|
||||
if (! (y && x =< 0x0b || true)) [x]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
contract Remote =
|
||||
entrypoint foo : () => ()
|
||||
entrypoint foo : () => unit
|
||||
|
||||
contract AddressLiterals =
|
||||
entrypoint addr1() : bytes(32) =
|
||||
|
||||
@@ -3,8 +3,8 @@ contract Remote =
|
||||
entrypoint up_to : (int) => list(int)
|
||||
entrypoint sum : (list(int)) => int
|
||||
entrypoint some_string : () => string
|
||||
entrypoint pair : (int, string) => (int, string)
|
||||
entrypoint squares : (int) => list((int, int))
|
||||
entrypoint pair : (int, string) => int * string
|
||||
entrypoint squares : (int) => list(int * int)
|
||||
entrypoint filter_some : (list(option(int))) => list(int)
|
||||
entrypoint all_some : (list(option(int))) => option(list(int))
|
||||
|
||||
@@ -47,7 +47,7 @@ contract ComplexTypes =
|
||||
|
||||
entrypoint pair(x : int, y : string) = (x, y)
|
||||
|
||||
entrypoint remote_pair(n : int, s : string) : (int, string) =
|
||||
entrypoint remote_pair(n : int, s : string) : int * string =
|
||||
state.worker.pair(gas = 10000, n, s)
|
||||
|
||||
entrypoint map(f, xs) =
|
||||
@@ -58,7 +58,7 @@ contract ComplexTypes =
|
||||
entrypoint squares(n) =
|
||||
map((i) => (i, i * i), up_to(n))
|
||||
|
||||
entrypoint remote_squares(n) : list((int, int)) =
|
||||
entrypoint remote_squares(n) : list(int * int) =
|
||||
state.worker.squares(n)
|
||||
|
||||
// option types
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
contract Remote =
|
||||
entrypoint dummy : () => ()
|
||||
entrypoint dummy : () => unit
|
||||
|
||||
contract Events =
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ contract FunctionArguments =
|
||||
entrypoint traffic_light(c : colour) =
|
||||
Red
|
||||
|
||||
entrypoint tuples(t : ()) =
|
||||
entrypoint tuples(t : unit) =
|
||||
t
|
||||
|
||||
entrypoint due(t : Chain.ttl) =
|
||||
|
||||
@@ -93,8 +93,8 @@ contract Maps =
|
||||
entrypoint tolist_state_s() = tolist_s(state.map_s)
|
||||
|
||||
// Map.from_list
|
||||
entrypoint fromlist_i(xs : list((int, pt))) = Map.from_list(xs)
|
||||
entrypoint fromlist_s(xs : list((string, pt))) = Map.from_list(xs)
|
||||
entrypoint fromlist_i(xs : list(int * pt)) = Map.from_list(xs)
|
||||
entrypoint fromlist_s(xs : list(string * pt)) = Map.from_list(xs)
|
||||
stateful entrypoint fromlist_state_i(xs) = put(state{ map_i = fromlist_i(xs) })
|
||||
stateful entrypoint fromlist_state_s(xs) = put(state{ map_s = fromlist_s(xs) })
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Lib =
|
||||
entrypoint foo() = ()
|
||||
|
||||
contract Remote =
|
||||
public function foo : () => ()
|
||||
public function foo : () => unit
|
||||
function bla() = ()
|
||||
|
||||
contract Contract =
|
||||
|
||||
@@ -60,23 +60,23 @@ contract Oracles =
|
||||
res
|
||||
|
||||
stateful entrypoint extendOracle(o : oracle_id,
|
||||
ttl : ttl) : () =
|
||||
ttl : ttl) : unit =
|
||||
Oracle.extend(o, ttl)
|
||||
|
||||
stateful entrypoint signedExtendOracle(o : oracle_id,
|
||||
sign : signature, // Signed oracle address
|
||||
ttl : ttl) : () =
|
||||
ttl : ttl) : unit =
|
||||
Oracle.extend(o, signature = sign, ttl)
|
||||
|
||||
stateful entrypoint respond(o : oracle_id,
|
||||
q : query_id,
|
||||
r : answer_t) : () =
|
||||
r : answer_t) : unit =
|
||||
Oracle.respond(o, q, r)
|
||||
|
||||
stateful entrypoint signedRespond(o : oracle_id,
|
||||
q : query_id,
|
||||
sign : signature,
|
||||
r : answer_t) : () =
|
||||
r : answer_t) : unit =
|
||||
Oracle.respond(o, q, signature = sign, r)
|
||||
|
||||
entrypoint getQuestion(o : oracle_id,
|
||||
|
||||
@@ -21,7 +21,7 @@ contract Oracles =
|
||||
function respond(o : oracle_id,
|
||||
q : query_id,
|
||||
sign : signature,
|
||||
r : answer_t) : () =
|
||||
r : answer_t) : unit =
|
||||
Oracle.respond(o, q, signature = sign, r)
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ contract Remote2 =
|
||||
|
||||
contract Remote3 =
|
||||
entrypoint get : () => int
|
||||
entrypoint tick : () => ()
|
||||
entrypoint tick : () => unit
|
||||
|
||||
contract RemoteCall =
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
contract Remote =
|
||||
record rstate = { i : int, s : string, m : map(int, int) }
|
||||
|
||||
entrypoint look_at : (rstate) => ()
|
||||
entrypoint look_at : (rstate) => unit
|
||||
entrypoint return_s : (bool) => string
|
||||
entrypoint return_m : (bool) => map(int, int)
|
||||
entrypoint get : (rstate) => rstate
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
contract Remote =
|
||||
stateful entrypoint remote_spend : (address, int) => ()
|
||||
stateful entrypoint remote_spend : (address, int) => unit
|
||||
entrypoint remote_pure : int => int
|
||||
|
||||
contract Stateful =
|
||||
@@ -32,7 +32,7 @@ contract Stateful =
|
||||
entrypoint ok4(a : address) = fail4(a)
|
||||
|
||||
// Lamdbas are checked at the construction site
|
||||
function fail5() : address => () = (a) => Chain.spend(a, 1000)
|
||||
function fail5() : address => unit = (a) => Chain.spend(a, 1000)
|
||||
|
||||
// .. so you can pass a stateful lambda to a non-stateful higher-order
|
||||
// function:
|
||||
|
||||
@@ -8,7 +8,7 @@ contract VotingType =
|
||||
function delegate : address => unit
|
||||
function vote : int => unit
|
||||
function winnerName : unit => string
|
||||
function currentTally : unit => list((string, int))
|
||||
function currentTally : unit => list(string * int)
|
||||
|
||||
/* Contract implementation */
|
||||
contract Voting =
|
||||
|
||||
Reference in New Issue
Block a user