diff --git a/ethcore/src/pod_state.rs b/ethcore/src/pod_state.rs index d99344adb..c6176914b 100644 --- a/ethcore/src/pod_state.rs +++ b/ethcore/src/pod_state.rs @@ -94,14 +94,14 @@ mod test { storage: map![], } ])); - assert_eq!(super::diff_pod(&PodState::new(), &a), StateDiff(map![ + assert_eq!(super::diff_pod(&PodState::new(), &a), StateDiff{ raw: map![ 1.into() => AccountDiff{ balance: Diff::Born(69.into()), nonce: Diff::Born(0.into()), code: Diff::Born(vec![]), storage: map![], } - ])); + ]}); } #[test] @@ -111,22 +111,22 @@ mod test { 1.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]), 2.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); - assert_eq!(super::diff_pod(&a, &b), StateDiff(map![ + assert_eq!(super::diff_pod(&a, &b), StateDiff { raw: map![ 2.into() => AccountDiff{ balance: Diff::Born(69.into()), nonce: Diff::Born(0.into()), code: Diff::Born(vec![]), storage: map![], } - ])); - assert_eq!(super::diff_pod(&b, &a), StateDiff(map![ + ]}); + assert_eq!(super::diff_pod(&b, &a), StateDiff { raw: map![ 2.into() => AccountDiff{ balance: Diff::Died(69.into()), nonce: Diff::Died(0.into()), code: Diff::Died(vec![]), storage: map![], } - ])); + ]}); } #[test] @@ -139,14 +139,14 @@ mod test { 1.into() => PodAccount::new(69.into(), 1.into(), vec![], map![]), 2.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); - assert_eq!(super::diff_pod(&a, &b), StateDiff(map![ + assert_eq!(super::diff_pod(&a, &b), StateDiff { raw: map![ 1.into() => AccountDiff{ balance: Diff::Same, nonce: Diff::Changed(0.into(), 1.into()), code: Diff::Same, storage: map![], } - ])); + ]}); } } diff --git a/ethcore/src/tests/rpc.rs b/ethcore/src/tests/rpc.rs index f683a1d25..ce1efd4bb 100644 --- a/ethcore/src/tests/rpc.rs +++ b/ethcore/src/tests/rpc.rs @@ -16,7 +16,45 @@ //! Client RPC tests +use nanoipc; +use std::sync::Arc; +use std::io::Write; +use std::sync::atomic::{Ordering, AtomicBool}; +use client::{BlockChainClient, MiningBlockChainClient, Client, ClientConfig, BlockID, RemoteClient}; +use block::IsBlock; +use tests::helpers::*; +use common::*; +use devtools::*; +use miner::Miner; +use crossbeam; + +pub fn run_test_worker(scope: &crossbeam::Scope, stop: Arc, socket_path: &str) { + let socket_path = socket_path.to_owned(); + scope.spawn(move || { + let client = Client::new( + ClientConfig::default(), + get_test_spec(), + dir.as_path(), + Arc::new(Miner::with_spec(get_test_spec())), + IoChannel::disconnected()).unwrap(); + let mut worker = nanoipc::Worker::new(&Arc::new(client)); + worker.add_reqrep(&socket_path).unwrap(); + while !stop.load(Ordering::Relaxed) { + worker.poll(); + } + }); +} + #[test] fn can_be_created() { + crossbeam::scope(|scope| { + let stop_guard = StopGuard::new(); + let socket_path = "ipc:///tmp/parity-client-rpc-10.ipc"; + run_test_worker(scope, stop_guard.share(), socket_path); + let remote_client = nanoipc::init_client::>(socket_path).unwrap(); + let non_existant = remote_client.block_header(BlockID::Number(188)); + + assert!(non_existant.is_none()); + }) } diff --git a/ethcore/src/types/filter.rs b/ethcore/src/types/filter.rs index af278cd92..d8d5d03bd 100644 --- a/ethcore/src/types/filter.rs +++ b/ethcore/src/types/filter.rs @@ -120,7 +120,7 @@ mod tests { from_block: BlockID::Earliest, to_block: BlockID::Latest, address: None, - topics: [None, None, None, None] + topics: vec![None, None, None, None], }; let possibilities = none_filter.bloom_possibilities(); @@ -135,9 +135,11 @@ mod tests { from_block: BlockID::Earliest, to_block: BlockID::Latest, address: Some(vec![Address::from_str("b372018f3be9e171df0581136b59d2faf73a7d5d").unwrap()]), - topics: [ + topics: vec![ Some(vec![H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap()]), - None, None, None + None, + None, + None, ] }; @@ -151,10 +153,11 @@ mod tests { from_block: BlockID::Earliest, to_block: BlockID::Latest, address: Some(vec![Address::from_str("b372018f3be9e171df0581136b59d2faf73a7d5d").unwrap()]), - topics: [ + topics: vec![ Some(vec![H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap()]), Some(vec![H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap()]), - None, None + None, + None, ] }; @@ -171,7 +174,7 @@ mod tests { Address::from_str("b372018f3be9e171df0581136b59d2faf73a7d5d").unwrap(), Address::from_str("b372018f3be9e171df0581136b59d2faf73a7d5d").unwrap(), ]), - topics: [ + topics: vec![ Some(vec![ H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap(), H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap() @@ -197,10 +200,11 @@ mod tests { from_block: BlockID::Earliest, to_block: BlockID::Latest, address: Some(vec![Address::from_str("b372018f3be9e171df0581136b59d2faf73a7d5d").unwrap()]), - topics: [ + topics: vec![ Some(vec![H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23f9").unwrap()]), Some(vec![H256::from_str("ff74e91598aed6ae5d2fdcf8b24cd2c7be49a0808112a305069355b7160f23fa").unwrap()]), - None, None + None, + None, ] };