should_panic test
This commit is contained in:
parent
3b01ca93cd
commit
71786dd172
@ -198,7 +198,11 @@ impl Account {
|
|||||||
pub fn add_balance(&mut self, x: &U256) { self.balance = self.balance + *x; }
|
pub fn add_balance(&mut self, x: &U256) { self.balance = self.balance + *x; }
|
||||||
|
|
||||||
/// Increment the nonce of the account by one.
|
/// Increment the nonce of the account by one.
|
||||||
pub fn sub_balance(&mut self, x: &U256) { self.balance = self.balance - *x; }
|
/// Panics if balance is less than `x`
|
||||||
|
pub fn sub_balance(&mut self, x: &U256) {
|
||||||
|
assert!(self.balance >= *x);
|
||||||
|
self.balance = self.balance - *x;
|
||||||
|
}
|
||||||
|
|
||||||
/// Commit the `storage_overlay` to the backing DB and update `storage_root`.
|
/// Commit the `storage_overlay` to the backing DB and update `storage_root`.
|
||||||
pub fn commit_storage(&mut self, db: &mut AccountDBMut) {
|
pub fn commit_storage(&mut self, db: &mut AccountDBMut) {
|
||||||
|
@ -355,6 +355,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[should_panic]
|
||||||
fn can_call_fail_empty() {
|
fn can_call_fail_empty() {
|
||||||
let mut setup = TestSetup::new();
|
let mut setup = TestSetup::new();
|
||||||
let state = setup.state.reference_mut();
|
let state = setup.state.reference_mut();
|
||||||
|
Loading…
Reference in New Issue
Block a user