initial test setup
This commit is contained in:
parent
1ae4da46b3
commit
cc4206f690
@ -257,3 +257,49 @@ impl<'a> Ext for Externalities<'a> {
|
|||||||
self.substate.sstore_clears_count = self.substate.sstore_clears_count + U256::one();
|
self.substate.sstore_clears_count = self.substate.sstore_clears_count + U256::one();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use common::*;
|
||||||
|
use state::*;
|
||||||
|
use engine::*;
|
||||||
|
use executive::*;
|
||||||
|
use evm::{self, Schedule, Ext, ContractCreateResult, MessageCallResult};
|
||||||
|
use substate::*;
|
||||||
|
use tests::helpers::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn get_test_origin() -> OriginInfo {
|
||||||
|
OriginInfo {
|
||||||
|
address: Address::zero(),
|
||||||
|
origin: Address::zero(),
|
||||||
|
gas_price: U256::zero(),
|
||||||
|
value: U256::zero()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_test_env_info() -> EnvInfo {
|
||||||
|
EnvInfo {
|
||||||
|
number: 100,
|
||||||
|
author: x!(0),
|
||||||
|
timestamp: 0,
|
||||||
|
difficulty: x!(0),
|
||||||
|
last_hashes: vec![],
|
||||||
|
gas_used: x!(0),
|
||||||
|
gas_limit: x!(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_be_created() {
|
||||||
|
let mut state_result = get_temp_state();
|
||||||
|
let state = state_result.reference_mut();
|
||||||
|
let test_spec = get_test_spec();
|
||||||
|
let test_engine: &Engine = &*test_spec.to_engine().unwrap();
|
||||||
|
let mut test_sub_state = Substate::new();
|
||||||
|
let env_info = get_test_env_info();
|
||||||
|
|
||||||
|
let ext = Externalities::new(state, &env_info, test_engine, 0, get_test_origin(), &mut test_sub_state, OutputPolicy::InitContract);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -56,6 +56,12 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use common::*;
|
use common::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn created() {
|
||||||
|
let mut sub_state = Substate::new();
|
||||||
|
assert_eq!(sub_state.suicides.len(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn accrue() {
|
fn accrue() {
|
||||||
let mut sub_state = Substate::new();
|
let mut sub_state = Substate::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user