Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta authored and Virgil Serbanuta committed Sep 10, 2024
1 parent 89754c9 commit 29bc2cc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/mx-rust/storage.2.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

addAccount("Owner");
setCallee("Owner");
new Storage;
set_named "self";
push_named "self";
call Storage.get_no_arg;
get_bigint_from_struct;
check_eq mxIntValue(0)
20 changes: 20 additions & 0 deletions tests/mx-rust/storage.3.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
addAccount("Owner");
setCallee("Owner");
new Storage;
set_named "self";

push_named "self";
push 10u64;
call Storage.set_no_arg_if_empty;
push_named "self";
call Storage.get_no_arg;
get_bigint_from_struct;
check_eq mxIntValue(10);

push_named "self";
push 20u64;
call Storage.set_no_arg_if_empty;
push_named "self";
call Storage.get_no_arg;
get_bigint_from_struct;
check_eq mxIntValue(20)
4 changes: 4 additions & 0 deletions tests/mx-rust/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ pub trait Storage {
fn get_no_arg(&self) -> BigUint {
self.no_arg_storage().get()
}

fn set_no_arg_if_empty(&self, value: u64) {
self.no_arg_storage().set_if_empty(BigUint::from(value))
}
}

0 comments on commit 29bc2cc

Please sign in to comment.