returning client to the place it should be, cleanup

This commit is contained in:
Nikolay Volf 2016-02-09 00:54:33 +03:00
parent 3ef3f5ac31
commit fc0153a5a4
7 changed files with 26 additions and 12 deletions

View File

@ -262,10 +262,7 @@ mod tests {
use common::*;
use block::*;
use spec::*;
use engine::*;
use evm::Schedule;
use evm::Factory;
use tests::helpers::*;
use super::*;
use super::super::new_morden;
@ -319,7 +316,7 @@ mod tests {
#[test]
fn can_return_factory() {
let engine = Ethash::new_test(new_morden());
let factory = engine.vm_factory();
engine.vm_factory();
}
#[test]
@ -359,7 +356,7 @@ mod tests {
match verify_result {
Err(Error::Block(BlockError::InvalidSealArity(_))) => {},
_ => { panic!("should be block difficulty error"); }
_ => { panic!("should be block seal mismatch error"); }
}
}
@ -377,6 +374,22 @@ mod tests {
}
}
#[test]
fn can_do_proof_of_work_verification_fail() {
let engine = Ethash::new_test(new_morden());
let mut header: Header = Header::default();
header.set_seal(vec![rlp::encode(&H256::zero()).to_vec(), rlp::encode(&H64::zero()).to_vec()]);
header.set_difficulty(U256::from_str("ffffffffffffffffffffffffffffffffffffffffffffaaaaaaaaaaaaaaaaaaaa").unwrap());
let verify_result = engine.verify_block_basic(&header, None);
match verify_result {
Err(Error::Block(BlockError::InvalidProofOfWork(_))) => {},
_ => { panic!("should be invalid proof of work error"); }
}
}
// TODO: difficulty test
}

View File

@ -159,11 +159,13 @@ macro_rules! evm_test_ignore(
#[test]
#[ignore]
#[cfg(feature = "jit")]
#[cfg(feature = "ignored-tests")]
fn $name_jit() {
$name_test(Factory::new(VMType::Jit));
}
#[test]
#[ignore]
#[cfg(feature = "ignored-tests")]
fn $name_int() {
$name_test(Factory::new(VMType::Interpreter));
}

View File

@ -360,6 +360,7 @@ impl<'a> Executive<'a> {
}
#[cfg(test)]
#[allow(dead_code)]
mod tests {
use super::*;
use common::*;
@ -599,6 +600,7 @@ mod tests {
}
// test is incorrect, mk
// TODO: fix (preferred) or remove
evm_test_ignore!{test_aba_calls: test_aba_calls_jit, test_aba_calls_int}
fn test_aba_calls(factory: Factory) {
// 60 00 - push 0
@ -659,6 +661,7 @@ mod tests {
}
// test is incorrect, mk
// TODO: fix (preferred) or remove
evm_test_ignore!{test_recursive_bomb1: test_recursive_bomb1_jit, test_recursive_bomb1_int}
fn test_recursive_bomb1(factory: Factory) {
// 60 01 - push 1
@ -704,6 +707,7 @@ mod tests {
}
// test is incorrect, mk
// TODO: fix (preferred) or remove
evm_test_ignore!{test_transact_simple: test_transact_simple_jit, test_transact_simple_int}
fn test_transact_simple(factory: Factory) {
let keypair = KeyPair::create().unwrap();
@ -902,5 +906,4 @@ mod tests {
}
}
}
}

View File

@ -20,7 +20,6 @@ mod test_common;
mod transaction;
mod executive;
mod state;
mod client;
mod chain;
mod homestead_state;
mod homestead_chain;

View File

@ -15,8 +15,8 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use client::{BlockChainClient,Client};
use super::test_common::*;
use tests::helpers::*;
use common::*;
#[test]
fn created() {

View File

@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
#[cfg(feature = "json-tests")]
use client::{BlockChainClient, Client};
use std::env;
use common::*;
@ -134,7 +133,6 @@ pub fn create_test_block_with_data(header: &Header, transactions: &[&SignedTrans
rlp.out()
}
#[cfg(feature = "json-tests")]
pub fn generate_dummy_client(block_number: u32) -> GuardedTempResult<Arc<Client>> {
let dir = RandomTempPath::new();
@ -174,7 +172,6 @@ pub fn generate_dummy_client(block_number: u32) -> GuardedTempResult<Arc<Client>
}
}
#[cfg(feature = "json-tests")]
pub fn get_test_client_with_blocks(blocks: Vec<Bytes>) -> GuardedTempResult<Arc<Client>> {
let dir = RandomTempPath::new();
let client = Client::new(get_test_spec(), dir.as_path(), IoChannel::disconnected()).unwrap();
@ -271,7 +268,6 @@ pub fn get_good_dummy_block() -> Bytes {
create_test_block(&block_header)
}
#[cfg(feature = "json-tests")]
pub fn get_bad_state_dummy_block() -> Bytes {
let mut block_header = Header::new();
let test_spec = get_test_spec();

View File

@ -15,3 +15,4 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
pub mod helpers;
mod client;