mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 13:56:58 +03:00
Update tests
This commit is contained in:
parent
a613f35c07
commit
93dbeb77b2
@ -16,19 +16,11 @@ program test.aleo {
|
||||
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() {
|
||||
transition finalize_no_params() -> () {
|
||||
return then finalize();
|
||||
}
|
||||
|
||||
finalize finalize_no_params() {
|
||||
finalize finalize_no_params() -> () {
|
||||
let current_value: u8 = Mapping::get_or_init(values, 0u8, 0u8);
|
||||
Mapping::set(values, 0u8, current_value + 1u8);
|
||||
let current_amount: u64 = Mapping::get_or_init(account, self.caller, 0u64);
|
||||
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
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;
|
||||
}
|
||||
}
|
@ -16,14 +16,6 @@ program test.aleo {
|
||||
account.set(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();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
@ -6,13 +6,15 @@ expectation: Pass
|
||||
program test.aleo {
|
||||
|
||||
inline foo(a: u8, b: u8) -> u8 {
|
||||
assert_neq(a, b);
|
||||
return a + b;
|
||||
}
|
||||
|
||||
transition public_adder(public a: u8, public b: u8) {
|
||||
return then finalize(a, b);
|
||||
} finalize public_adder(a: u8, b: u8) -> public u8 {
|
||||
return foo(a, b);
|
||||
} finalize public_adder(a: u8, b: u8) {
|
||||
let result: u8 = foo(a, b);
|
||||
assert_neq(result, 0u8);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ program test.aleo {
|
||||
mapping balances: address => u128;
|
||||
|
||||
struct Token {
|
||||
owner: address;
|
||||
Owner: address;
|
||||
balance: u128;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ expectation: Pass
|
||||
program test.aleo {
|
||||
transition matches(addr: address) -> bool {
|
||||
return self.caller == addr then finalize(self.caller);
|
||||
} finalize matches(addr: address) -> bool {
|
||||
return addr == self.caller;
|
||||
} finalize matches(addr: address) {
|
||||
assert_eq(addr, self.caller);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user