Update tests

This commit is contained in:
d0cd 2022-10-16 12:04:54 -07:00
parent 25a15aae75
commit 8048d2754b
16 changed files with 32 additions and 22 deletions

View File

@ -5,8 +5,7 @@ expectation: Fail
program test.aleo { program test.aleo {
function foo(a: u8, b: u8) -> u8 { function foo(a: u8, b: u8) -> u8 {
async finalize(a, b); return a + b then finalize(a, b);
return a + b;
} }
function bar(a: u8, b: u8) -> u8 { function bar(a: u8, b: u8) -> u8 {
@ -19,7 +18,7 @@ program test.aleo {
function mint_public(receiver: address, amount: u64) { function mint_public(receiver: address, amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public(receiver: address, amount: u64) { finalize mint_public(receiver: address, amount: u64) {

View File

@ -7,7 +7,7 @@ program test.aleo {
mapping amounts: address => u128; mapping amounts: address => u128;
transition decrease_self(amount: u128) { transition decrease_self(amount: u128) {
async finalize(self.caller, amount); return then finalize(self.caller, amount);
} }
finalize decrease_self(addr: address, amount: u128) { finalize decrease_self(addr: address, amount: u128) {

View File

@ -14,7 +14,7 @@ program test.aleo {
mapping tokens: address => Token; mapping tokens: address => Token;
transition decrease_self(amount: u128) { transition decrease_self(amount: u128) {
async finalize(self.caller, amount); return then finalize(self.caller, amount);
} }
finalize decrease_self(addr: address, amount: u128) { finalize decrease_self(addr: address, amount: u128) {

View File

@ -6,7 +6,7 @@ expectation: Fail
program test.aleo { program test.aleo {
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public (public receiver: address, public amount: u64) {} finalize mint_public (public receiver: address, public amount: u64) {}

View File

@ -8,15 +8,23 @@ program test.aleo {
mapping values: u8 => u8; mapping values: u8 => u8;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public (public receiver: address, public amount: u64) { finalize mint_public (public receiver: address, public amount: u64) {
increment(account, receiver, amount); increment(account, receiver, amount);
} }
transition public_adder(public a: u8, public b: u8) {
return then finalize(a, b);
}
finalize public_adder(a: u8, b: u8) -> public u8 {
return a + b;
}
transition finalize_no_params() { transition finalize_no_params() {
async finalize(); return then finalize();
} }
finalize finalize_no_params() { finalize finalize_no_params() {

View File

@ -7,7 +7,7 @@ program test.aleo {
mapping account: address => u64; mapping account: address => u64;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 { finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {
@ -15,7 +15,7 @@ program test.aleo {
} }
transition mint_public2(public receiver: address, public amount: u64) { transition mint_public2(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public2(public receiver: address, amount: u64) -> u64 { finalize mint_public2(public receiver: address, amount: u64) -> u64 {

View File

@ -7,7 +7,7 @@ program test.aleo {
mapping account: address => u64; mapping account: address => u64;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public(public receiver: address, public amount: u64) -> u64 { finalize mint_public(public receiver: address, public amount: u64) -> u64 {

View File

@ -8,7 +8,7 @@ program test.aleo {
mapping account: address => u64; mapping account: address => u64;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_public (public receiver: address, public amount: u64) -> u64 { finalize mint_public (public receiver: address, public amount: u64) -> u64 {

View File

@ -8,7 +8,7 @@ program test.aleo {
mapping values: u8 => u8; mapping values: u8 => u8;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount); return then finalize(receiver, amount);
} }
finalize mint_private (public receiver: address, public amount: u64) { finalize mint_private (public receiver: address, public amount: u64) {

View File

@ -8,7 +8,7 @@ program test.aleo {
mapping account: address => u64; mapping account: address => u64;
transition mint_public(public receiver: address, public amount: u64) { transition mint_public(public receiver: address, public amount: u64) {
async finalize(receiver, amount, amount); return then finalize(receiver, amount, amount);
} }
finalize mint_public (public receiver: address, public amount: u64) { finalize mint_public (public receiver: address, public amount: u64) {

View File

@ -7,7 +7,7 @@ program test.aleo {
mapping amounts: address => u128; mapping amounts: address => u128;
transition increase_self(amount: u128) { transition increase_self(amount: u128) {
async finalize(self.caller, amount); return then finalize(self.caller, amount);
} }
finalize increase_self(addr: address, amount: u128) { finalize increase_self(addr: address, amount: u128) {

View File

@ -14,7 +14,7 @@ program test.aleo {
mapping tokens: address => Token; mapping tokens: address => Token;
transition increase_self(amount: u128) { transition increase_self(amount: u128) {
async finalize(self.caller, amount); return then finalize(self.caller, amount);
} }
finalize increase_self(addr: address, amount: u128) { finalize increase_self(addr: address, amount: u128) {

View File

@ -23,7 +23,7 @@ program test.aleo {
} }
function write_in_finalize(public addr: address, public amount: u128) { function write_in_finalize(public addr: address, public amount: u128) {
async finalize(addr, amount); return then finalize(addr, amount);
} }
finalize write_in_finalize(public: addr: address, public amount: u128) { finalize write_in_finalize(public: addr: address, public amount: u128) {

View File

@ -5,8 +5,7 @@ expectation: Pass
program test.aleo { program test.aleo {
transition matches(addr: address) -> bool { transition matches(addr: address) -> bool {
async finalize(self.caller); return self.caller == addr then finalize(self.caller);
return self.caller == addr;
} finalize matches(addr: address) -> bool { } finalize matches(addr: address) -> bool {
return addr == self.caller; return addr == self.caller;
} }

View File

@ -3,8 +3,10 @@ namespace: ParseStatement
expectation: Pass expectation: Pass
*/ */
async finalize(); return then finalize;
async finalize(foo); return then finalize();
async finalize(foo, bar); return then finalize(foo);
return then finalize(foo, bar);

View File

@ -14,3 +14,5 @@ async async finalize(foo);
finalize; finalize;
asyn finalize(foo); asyn finalize(foo);
return then fin;