-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: try to panic by calling private fn * feat: removing panic test * nit: format * nit
- Loading branch information
Showing
1 changed file
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
mod tests { // TODO | ||
mod tests { | ||
use visibility::{visibility::{IExampleContract, ExampleContract}}; | ||
|
||
use starknet::{ | ||
ContractAddress, get_contract_address, contract_address_const, call_contract_syscall, | ||
testing::{set_contract_address} | ||
}; | ||
|
||
fn setup() -> ExampleContract::ContractState { | ||
let mut state = ExampleContract::contract_state_for_testing(); | ||
let contract_address = contract_address_const::<0x1>(); | ||
set_contract_address(contract_address); | ||
state | ||
} | ||
|
||
#[test] | ||
#[available_gas(2000000000)] | ||
fn can_call_set_and_get() { | ||
let mut state = setup(); | ||
let init_value: u32 = 42; | ||
state.set(init_value); | ||
let received_value = state.get(); | ||
|
||
assert(received_value == init_value, 'wrong value received'); | ||
} | ||
} |