Add tests that should pass

This commit is contained in:
Pranav Gaddamadugu 2023-04-05 09:28:17 -07:00
parent ff5ce80be3
commit 0d64247b1e
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/*
namespace: Compile
expectation: Pass
*/
program test.aleo {
mapping amounts: address => u128;
transition decrease_self(amount: u128) {
return then finalize(self.caller, amount);
}
finalize decrease_self(addr: address, amount: u128) {
let current_amount: u128 = Mapping::get_or(amounts, addr, 0u128);
Mapping::set(amounts, addr, current_amount - amount);
}
}

View File

@ -0,0 +1,37 @@
/*
namespace: Compile
expectation: Pass
*/
program test.aleo {
mapping account: address => u64;
mapping values: u8 => u8;
transition mint_public(public receiver: address, public amount: u64) {
return then finalize(receiver, amount);
}
finalize mint_public (public receiver: address, public amount: u64) {
let current_amount: u64 = Mapping::get_or(account, receiver, 0u64);
Mapping::set(account, receiver, current_amount + 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() {
return then finalize();
}
finalize finalize_no_params() {
let current_value: u8 = Mapping::get_or(values, 0u8, 0u8);
Mapping::set(values, 0u8, current_value + 1u8);
let current_amount: u64 = Mapping::get_or(account, self.caller, 0u64);
Mapping::set(account, self.caller, current_amount + 1u64);
}
}

View File

@ -0,0 +1,17 @@
/*
namespace: Compile
expectation: Pass
*/
program test.aleo {
mapping amounts: address => u128;
transition increase_self(amount: u128) {
return then finalize(self.caller, amount);
}
finalize increase_self(addr: address, amount: u128) {
let current_amount: u128 = Mapping::get_or(amounts, addr, 0u128);
Mapping::set(amounts, addr, current_amount + amount);
}
}