executive tests in progress
This commit is contained in:
parent
43c612fa89
commit
68beb0099d
@ -215,9 +215,35 @@ impl<'a> Ext for Executive<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use rustc_serialize::hex::FromHex;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use util::hash::*;
|
use util::hash::*;
|
||||||
use util::uint::*;
|
use util::uint::*;
|
||||||
|
use evm::*;
|
||||||
|
use transaction::*;
|
||||||
|
use env_info::*;
|
||||||
|
use state::*;
|
||||||
|
use spec::*;
|
||||||
|
use engine::*;
|
||||||
|
use evm_schedule::*;
|
||||||
|
|
||||||
|
struct TestEngine {
|
||||||
|
spec: Spec
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TestEngine {
|
||||||
|
fn new() -> Self {
|
||||||
|
TestEngine {
|
||||||
|
spec: Spec::frontier()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Engine for TestEngine {
|
||||||
|
fn name(&self) -> &str { "TestEngine" }
|
||||||
|
fn spec(&self) -> &Spec { &self.spec }
|
||||||
|
fn evm_schedule(&self, _env_info: &EnvInfo) -> EvmSchedule { EvmSchedule::new_frontier() }
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_contract_address() {
|
fn test_contract_address() {
|
||||||
@ -225,4 +251,24 @@ mod tests {
|
|||||||
let contract_address = Address::from_str("3f09c73a5ed19289fb9bdc72f1742566df146f56").unwrap();
|
let contract_address = Address::from_str("3f09c73a5ed19289fb9bdc72f1742566df146f56").unwrap();
|
||||||
assert_eq!(contract_address, super::contract_address(&address, &U256::from(88)));
|
assert_eq!(contract_address, super::contract_address(&address, &U256::from(88)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_executive() {
|
||||||
|
//let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
|
||||||
|
//let new_address = super::contract_address(&address, &U256::zero());
|
||||||
|
//let mut state = State::new_temp();
|
||||||
|
//state.add_balance(&address, &U256::from(0x100_000_000u64));
|
||||||
|
//let info = EnvInfo::new();
|
||||||
|
//let engine = TestEngine::new();
|
||||||
|
//let mut transaction = Transaction::new();
|
||||||
|
//transaction.data = "3331600055".from_hex().unwrap();
|
||||||
|
//transaction.gas = U256::from(0x174876e800u64);
|
||||||
|
|
||||||
|
//{
|
||||||
|
//let mut ex = Executive::new(&mut state, &info, &engine, &transaction);
|
||||||
|
//ex.exec();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//assert_eq!(state.storage_at(&new_address, &H256::new()), H256::from(&U256::from(0x100_000_000u64)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user