Merge pull request #392 from paritytech/removed_devtools

replace devtools with tempdir, test-data is only a dev-dependency
This commit is contained in:
Svyatoslav Nikolsky 2017-04-07 09:22:18 +03:00 committed by GitHub
commit d054d3592d
36 changed files with 99 additions and 231 deletions

32
Cargo.lock generated
View File

@ -91,7 +91,7 @@ name = "bigint"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -150,7 +150,7 @@ name = "chain"
version = "0.1.0"
dependencies = [
"bitcrypto 0.1.0",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"primitives 0.1.0",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"serialization 0.1.0",
@ -198,12 +198,12 @@ dependencies = [
"bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"chain 0.1.0",
"elastic-array 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-devtools 1.3.0",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"primitives 0.1.0",
"rocksdb 0.4.5 (git+https://github.com/ethcore/rust-rocksdb)",
"serialization 0.1.0",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"test-data 0.1.0",
]
@ -236,7 +236,7 @@ name = "elastic-array"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -260,13 +260,6 @@ dependencies = [
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ethcore-devtools"
version = "1.3.0"
dependencies = [
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures"
version = "0.1.12"
@ -291,7 +284,7 @@ dependencies = [
[[package]]
name = "heapsize"
version = "0.3.8"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -500,7 +493,7 @@ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chain 0.1.0",
"db 0.1.0",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"keys 0.1.0",
"network 0.1.0",
"primitives 0.1.0",
@ -735,7 +728,7 @@ version = "0.1.0"
dependencies = [
"bigint 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1021,6 +1014,14 @@ dependencies = [
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tempdir"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "term_size"
version = "0.2.3"
@ -1230,7 +1231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum futures 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "0ffa9721bfc26c0293ab2195bbf037aefb3951ece8d755e01fb90e0177acba79"
"checksum futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a283c84501e92cade5ea673a2a7ca44f71f209ccdd302a3e0896f50083d2c5ff"
"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae"
"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88"
"checksum heapsize 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "556cd479866cf85c3f671209c85e8a6990211c916d1002c2fcb2e9b7cf60bc36"
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
"checksum hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)" = "<none>"
"checksum idna 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac85ec3f80c8e4e99d9325521337e14ec7555c458a14e377d189659a427f375"
@ -1294,6 +1295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
"checksum syn 0.11.10 (registry+https://github.com/rust-lang/crates.io-index)" = "171b739972d9a1bfb169e8077238b51f9ebeaae4ff6e08072f7ba386a8802da2"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a"
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
"checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a"

View File

@ -14,5 +14,5 @@ serialization = { path = "../serialization" }
chain = { path = "../chain" }
[dev-dependencies]
ethcore-devtools = { path = "../devtools" }
tempdir = "0.3"
test-data = { path = "../test-data" }

View File

@ -32,9 +32,9 @@ const COL_TRANSACTIONS: u32 = 4;
const COL_TRANSACTIONS_META: u32 = 5;
const COL_BLOCK_NUMBERS: u32 = 6;
const KEY_VERSION: &'static[u8] = b"version";
const KEY_BEST_BLOCK_NUMBER: &'static[u8] = b"best_block_number";
const KEY_BEST_BLOCK_HASH: &'static[u8] = b"best_block_hash";
const KEY_VERSION: &'static str = "version";
const KEY_BEST_BLOCK_NUMBER: &'static str = "best_block_number";
const KEY_BEST_BLOCK_HASH: &'static str = "best_block_hash";
const DB_VERSION: u32 = 1;
const MAX_FORK_ROUTE_PRESET: usize = 2048;
@ -105,8 +105,8 @@ impl<T> BlockChainDatabase<AutoFlushingOverlayDatabase<T>> where T: KeyValueData
impl<T> BlockChainDatabase<T> where T: KeyValueDatabase {
fn read_best_block(db: &T) -> Option<BestBlock> {
let best_number = db.get(COL_META.into(), KEY_BEST_BLOCK_NUMBER);
let best_hash = db.get(COL_META.into(), KEY_BEST_BLOCK_HASH);
let best_number = db.get(COL_META.into(), &serialize(&KEY_BEST_BLOCK_NUMBER));
let best_hash = db.get(COL_META.into(), &serialize(&KEY_BEST_BLOCK_HASH));
match (best_number, best_hash) {
(Ok(None), Ok(None)) => None,
@ -257,8 +257,8 @@ impl<T> BlockChainDatabase<T> where T: KeyValueDatabase {
let mut update = DBTransaction::new();
update.insert(COL_BLOCK_HASHES.into(), &new_best_block.number, &new_best_block.hash);
update.insert(COL_BLOCK_NUMBERS.into(), &new_best_block.hash, &new_best_block.number);
update.insert_raw(COL_META.into(), KEY_BEST_BLOCK_HASH, &serialize(&new_best_block.hash));
update.insert_raw(COL_META.into(), KEY_BEST_BLOCK_NUMBER, &serialize(&new_best_block.number));
update.insert(COL_META.into(), &KEY_BEST_BLOCK_HASH, &new_best_block.hash);
update.insert(COL_META.into(), &KEY_BEST_BLOCK_NUMBER, &new_best_block.number);
let mut modified_meta: HashMap<H256, TransactionMeta> = HashMap::new();
if let Some(tx) = block.transactions.first() {
@ -320,8 +320,8 @@ impl<T> BlockChainDatabase<T> where T: KeyValueDatabase {
let mut update = DBTransaction::new();
update.delete(COL_BLOCK_HASHES.into(), &block_number);
update.delete(COL_BLOCK_NUMBERS.into(), &block_hash);
update.insert_raw(COL_META.into(), KEY_BEST_BLOCK_HASH, &serialize(&new_best_block.hash));
update.insert_raw(COL_META.into(), KEY_BEST_BLOCK_NUMBER, &serialize(&new_best_block.number));
update.insert(COL_META.into(), &KEY_BEST_BLOCK_HASH, &new_best_block.hash);
update.insert(COL_META.into(), &KEY_BEST_BLOCK_NUMBER, &new_best_block.number);
let mut modified_meta: HashMap<H256, TransactionMeta> = HashMap::new();
for tx in block.transactions.iter().skip(1) {

View File

@ -291,15 +291,15 @@ impl Database {
#[cfg(test)]
mod tests {
extern crate ethcore_devtools as devtools;
extern crate tempdir;
use self::tempdir::TempDir;
use kv::{Transaction, Location};
use super::*;
use self::devtools::*;
fn test_db(config: DatabaseConfig) {
let path = RandomTempPath::create_dir();
let db = Database::open(config, path.as_path().to_str().unwrap()).unwrap();
let tempdir = TempDir::new("").unwrap();
let db = Database::open(config, tempdir.path()).unwrap();
let key1 = b"key1";
let key2 = b"key2";
@ -338,8 +338,8 @@ mod tests {
#[test]
fn kvdb() {
let path = RandomTempPath::create_dir();
let _ = Database::open_default(path.as_path().to_str().unwrap()).unwrap();
let tempdir = TempDir::new("").unwrap();
let _ = Database::open_default(tempdir.path()).unwrap();
test_db(DatabaseConfig::default());
}
}

View File

@ -1,14 +0,0 @@
[package]
description = "Ethcore development/test/build tools"
homepage = "http://ethcore.io"
license = "GPL-3.0"
name = "ethcore-devtools"
version = "1.3.0"
authors = ["Ethcore <admin@ethcore.io>"]
[dependencies]
rand = "0.3"
[lib]
path = "src/lib.rs"
test = true

View File

@ -1,24 +0,0 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! dev-tools
extern crate rand;
mod random_path;
pub use random_path::*;

View File

@ -1,131 +0,0 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Random path
use std::path::PathBuf;
use std::{fs, env, ops};
use rand::random;
pub struct RandomTempPath {
path: PathBuf
}
pub fn random_filename() -> String {
random_str(8)
}
pub fn random_str(len: usize) -> String {
(0..len).map(|_| ((random::<f32>() * 26.0) as u8 + 97) as char).collect()
}
impl RandomTempPath {
pub fn new() -> RandomTempPath {
let mut dir = env::temp_dir();
dir.push(random_filename());
RandomTempPath {
path: dir.clone()
}
}
pub fn create_dir() -> RandomTempPath {
let mut dir = env::temp_dir();
dir.push(random_filename());
fs::create_dir_all(dir.as_path()).unwrap();
RandomTempPath {
path: dir.clone()
}
}
pub fn as_path(&self) -> &PathBuf {
&self.path
}
pub fn as_str(&self) -> &str {
self.path.to_str().unwrap()
}
pub fn new_in(&self, name: &str) -> String {
let mut path = self.path.clone();
path.push(name);
path.to_str().unwrap().to_owned()
}
}
impl Drop for RandomTempPath {
fn drop(&mut self) {
if let Err(e) = fs::remove_dir_all(self.as_path()) {
panic!("Failed to remove temp directory. Here's what prevented this from happening: ({})", e);
}
}
}
pub struct GuardedTempResult<T> {
pub result: Option<T>,
pub _temp: RandomTempPath
}
impl<T> GuardedTempResult<T> {
pub fn reference(&self) -> &T {
self.result.as_ref().unwrap()
}
pub fn reference_mut(&mut self) -> &mut T {
self.result.as_mut().unwrap()
}
pub fn take(&mut self) -> T {
self.result.take().unwrap()
}
}
impl<T> ops::Deref for GuardedTempResult<T> {
type Target = T;
fn deref(&self) -> &T {
self.result.as_ref().unwrap()
}
}
impl<T> ops::DerefMut for GuardedTempResult<T> {
fn deref_mut(&mut self) -> &mut T {
self.result.as_mut().unwrap()
}
}
#[test]
fn creates_dir() {
let temp = RandomTempPath::create_dir();
assert!(fs::metadata(temp.as_path()).unwrap().is_dir());
}
#[test]
fn destroys_dir() {
let path_buf = {
let temp = RandomTempPath::create_dir();
assert!(fs::metadata(temp.as_path()).unwrap().is_dir());
let path_buf = temp.as_path().to_path_buf();
path_buf
};
assert!(fs::metadata(&path_buf).is_err());
}
#[test]
fn provides_random() {
let temp = RandomTempPath::create_dir();
assert!(temp.as_path().to_str().is_some());
}

View File

@ -13,6 +13,8 @@ network = { path = "../network" }
primitives = { path = "../primitives" }
serialization = { path = "../serialization" }
verification = { path = "../verification" }
test-data = { path = "../test-data" }
keys = { path = "../keys" }
script = { path = "../script" }
[dev-dependencies]
test-data = { path = "../test-data" }

View File

@ -18,9 +18,10 @@ pub fn transaction_fee_rate(store: &TransactionProvider, transaction: &Transacti
#[cfg(test)]
mod tests {
extern crate test_data;
use std::sync::Arc;
use db::{BlockChainDatabase, AsSubstore};
use test_data;
use super::*;
#[test]

View File

@ -10,7 +10,6 @@ extern crate network;
extern crate primitives;
extern crate serialization as ser;
extern crate verification;
extern crate test_data;
mod block_assembler;
mod cpu_miner;

View File

@ -865,10 +865,12 @@ impl<'a> Iterator for MemoryPoolIterator<'a> {
#[cfg(test)]
mod tests {
extern crate test_data;
use chain::{Transaction, OutPoint};
use heapsize::HeapSizeOf;
use super::{MemoryPool, OrderingStrategy, DoubleSpendCheckResult};
use test_data::{ChainBuilder, TransactionBuilder};
use self::test_data::{ChainBuilder, TransactionBuilder};
fn to_memory_pool(chain: &mut ChainBuilder) -> MemoryPool {
let mut pool = MemoryPool::new();

View File

@ -23,8 +23,10 @@ primitives = { path = "../primitives" }
p2p = { path = "../p2p" }
network = { path = "../network" }
db = { path = "../db" }
test-data = { path = "../test-data" }
miner = { path = "../miner" }
verification = { path = "../verification" }
script = { path = "../script" }
keys = { path = "../keys" }
[dev-dependencies]
test-data = { path = "../test-data" }

View File

@ -17,8 +17,6 @@ extern crate primitives;
extern crate p2p;
extern crate network;
extern crate db;
#[cfg(test)]
extern crate test_data;
extern crate miner;
extern crate verification;
extern crate script as global_script;

View File

@ -217,6 +217,8 @@ impl<T> BlockChain for BlockChainClient<T> where T: BlockChainClientCoreApi {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use std::sync::Arc;
use jsonrpc_core::IoHandler;
use jsonrpc_core::Error;
@ -231,7 +233,6 @@ pub mod tests {
use v1::types::H256;
use v1::types::ScriptType;
use chain::OutPoint;
use test_data;
use network::Magic;
use super::*;

View File

@ -159,6 +159,21 @@ impl Serializable for String {
}
}
impl<'a> Serializable for &'a str {
fn serialize(&self, stream: &mut Stream) {
let bytes: &[u8] = self.as_bytes();
stream
.append(&CompactInteger::from(bytes.len()))
.append_slice(bytes);
}
#[inline]
fn serialized_size(&self) -> usize {
let bytes: &[u8] = self.as_bytes();
CompactInteger::from(bytes.len()).serialized_size() + bytes.len()
}
}
impl Deserializable for String {
fn deserialize<T>(reader: &mut Reader<T>) -> Result<Self, Error> where T: io::Read {
let bytes: Bytes = try!(reader.read());

View File

@ -23,9 +23,11 @@ p2p = { path = "../p2p" }
primitives = { path = "../primitives" }
script = { path = "../script" }
serialization = { path = "../serialization" }
test-data = { path = "../test-data" }
verification = { path = "../verification" }
network = { path = "../network" }
[dev-dependencies]
test-data = { path = "../test-data" }
[features]
dev = []

View File

@ -150,10 +150,11 @@ impl TransactionVerificationSink for BlocksWriterSink {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::sync::Arc;
use db::{BlockChainDatabase};
use network::Magic;
use test_data;
use super::super::Error;
use super::{BlocksWriter, MAX_ORPHANED_BLOCKS};

View File

@ -12,7 +12,6 @@ extern crate linked_hash_map;
extern crate bit_vec;
extern crate murmur3;
extern crate primitives;
extern crate test_data;
extern crate time;
extern crate verification;
extern crate miner;

View File

@ -324,6 +324,8 @@ impl TransactionVerificationSink for TransactionAcceptSink {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use std::sync::Arc;
use parking_lot::RwLock;
use synchronization_executor::Task;
@ -338,7 +340,6 @@ pub mod tests {
use db::{BlockChainDatabase};
use miner::MemoryPool;
use super::LocalNode;
use test_data;
use synchronization_server::ServerTask;
use synchronization_server::tests::DummyServer;
use synchronization_verifier::tests::DummyVerifier;

View File

@ -716,13 +716,14 @@ impl fmt::Debug for Chain {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::sync::Arc;
use parking_lot::RwLock;
use chain::{Transaction, IndexedBlockHeader};
use db::BlockChainDatabase;
use miner::MemoryPool;
use primitives::hash::H256;
use test_data;
use super::{Chain, BlockState, TransactionState, BlockInsertionResult};
use utils::HashPosition;
@ -1096,7 +1097,7 @@ mod tests {
#[test]
fn update_memory_pool_transaction() {
use test_data::{ChainBuilder, TransactionBuilder};
use self::test_data::{ChainBuilder, TransactionBuilder};
let data_chain = &mut ChainBuilder::new();
TransactionBuilder::with_output(10).add_output(10).add_output(10).store(data_chain) // transaction0

View File

@ -1173,6 +1173,8 @@ impl<T> SynchronizationClientCore<T> where T: TaskExecutor {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use std::sync::Arc;
use parking_lot::{Mutex, RwLock};
use chain::{Block, Transaction};
@ -1182,7 +1184,6 @@ pub mod tests {
use miner::MemoryPool;
use network::Magic;
use primitives::hash::H256;
use test_data;
use verification::BackwardsCompatibleChainVerifier as ChainVerifier;
use inbound_connection::tests::DummyOutboundSyncConnection;
use synchronization_chain::Chain;

View File

@ -215,13 +215,14 @@ impl TaskExecutor for LocalSynchronizationTaskExecutor {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use super::*;
use std::sync::Arc;
use std::time;
use parking_lot::{Mutex, Condvar};
use chain::Transaction;
use message::types;
use test_data;
use inbound_connection::tests::DummyOutboundSyncConnection;
use local_node::tests::{default_filterload, make_filteradd};
use synchronization_peers::{PeersImpl, PeersContainer, PeersFilters, PeersOptions, BlockAnnouncementType};

View File

@ -284,9 +284,10 @@ pub fn manage_orphaned_transactions(config: &ManageOrphanTransactionsConfig, orp
#[cfg(test)]
mod tests {
extern crate test_data;
use std::collections::HashSet;
use primitives::hash::H256;
use test_data;
use synchronization_peers_tasks::PeersTasks;
use super::{ManagePeersConfig, ManageUnknownBlocksConfig, ManageOrphanTransactionsConfig, manage_synchronization_peers_blocks,
manage_unknown_orphaned_blocks, manage_orphaned_transactions};

View File

@ -459,6 +459,8 @@ impl<TExecutor> ServerTaskExecutor<TExecutor> where TExecutor: TaskExecutor {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use std::mem::replace;
use std::sync::Arc;
use parking_lot::{Mutex, RwLock};
@ -466,7 +468,6 @@ pub mod tests {
use message::types;
use message::common::{self, InventoryVector, InventoryType};
use primitives::hash::H256;
use test_data;
use chain::Transaction;
use inbound_connection::tests::DummyOutboundSyncConnection;
use miner::MemoryPool;

View File

@ -138,8 +138,9 @@ impl BestHeadersChain {
#[cfg(test)]
mod tests {
extern crate test_data;
use primitives::hash::H256;
use test_data;
use super::BestHeadersChain;
#[test]

View File

@ -178,13 +178,14 @@ impl BloomFilterData {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::iter::repeat;
use chain::IndexedTransaction;
use message::types;
use primitives::bytes::Bytes;
use primitives::hash::H256;
use ser::serialize;
use test_data;
use super::{BloomFilter, BloomFilterData};
fn default_filterload() -> types::FilterLoad {

View File

@ -71,10 +71,11 @@ pub fn short_transaction_id(key0: u64, key1: u64, transaction_hash: &H256) -> Sh
#[cfg(test)]
mod tests {
extern crate test_data;
use std::collections::HashSet;
use chain::{BlockHeader, Transaction, ShortTransactionID};
use message::common::{BlockHeaderAndIDs, PrefilledTransaction};
use test_data;
use super::*;
#[test]

View File

@ -123,11 +123,12 @@ impl ConnectionFilter {
#[cfg(test)]
pub mod tests {
extern crate test_data;
use std::iter::repeat;
use chain::IndexedTransaction;
use message::types;
use primitives::bytes::Bytes;
use test_data;
use super::ConnectionFilter;
use utils::KnownHashType;

View File

@ -94,12 +94,13 @@ impl PreviousTransactionOutputProvider for MemoryPoolTransactionOutputProvider {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::sync::Arc;
use parking_lot::RwLock;
use chain::OutPoint;
use db::{TransactionOutputObserver, PreviousTransactionOutputProvider, BlockChainDatabase};
use miner::MemoryPool;
use test_data;
use super::MemoryPoolTransactionOutputProvider;
#[test]

View File

@ -54,8 +54,9 @@ impl<'a> BlockHeaderProvider for MessageBlockHeadersProvider<'a> {
#[cfg(test)]
mod tests {
extern crate test_data;
use db::{AsSubstore, BlockHeaderProvider, BlockChainDatabase, BlockRef};
use test_data;
use primitives::hash::H256;
use super::MessageBlockHeadersProvider;

View File

@ -121,8 +121,9 @@ impl OrphanBlocksPool {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::collections::HashSet;
use test_data;
use primitives::hash::H256;
use super::OrphanBlocksPool;

View File

@ -132,8 +132,10 @@ impl OrphanTransaction {
#[cfg(test)]
mod tests {
extern crate test_data;
use std::collections::HashSet;
use test_data::{TransactionBuilder, ChainBuilder};
use self::test_data::{TransactionBuilder, ChainBuilder};
use primitives::hash::H256;
use super::OrphanTransactionsPool;

View File

@ -232,9 +232,10 @@ impl PartialMerkleTreeBuilder {
#[cfg(test)]
mod tests {
extern crate test_data;
use chain::{Transaction, merkle_root};
use primitives::hash::H256;
use test_data;
use super::{build_partial_merkle_tree, parse_partial_merkle_tree};
#[test]
@ -278,4 +279,4 @@ mod tests {
}
}
}
}
}

View File

@ -17,7 +17,6 @@ cd primitives
cargo clippy -p bitcrypto
cargo clippy -p chain
cargo clippy -p db
cargo clippy -p ethcore-devtools
cargo clippy -p import
cargo clippy -p keys
cargo clippy -p message

View File

@ -4,7 +4,6 @@ cargo doc --no-deps\
-p bitcrypto\
-p chain\
-p db\
-p ethcore-devtools\
-p import\
-p keys\
-p message\

View File

@ -4,7 +4,6 @@ cargo test\
-p bitcrypto\
-p chain\
-p db\
-p ethcore-devtools\
-p import\
-p keys\
-p message\