Move macros to util.
This commit is contained in:
parent
78b10fd5f2
commit
08824e3ece
@ -104,30 +104,6 @@ pub fn pod_map_diff(pre: &BTreeMap<Address, PodAccount>, post: &BTreeMap<Address
|
|||||||
pre.keys().merge(post.keys()).filter_map(|acc| pod_diff(pre.get(acc), post.get(acc)).map(|d|(acc.clone(), d))).collect()
|
pre.keys().merge(post.keys()).filter_map(|acc| pod_diff(pre.get(acc), post.get(acc)).map(|d|(acc.clone(), d))).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! map {
|
|
||||||
( $( $x:expr => $y:expr ),* ) => {
|
|
||||||
vec![ $( ($x, $y) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! mapx {
|
|
||||||
( $( $x:expr => $y:expr ),* ) => {
|
|
||||||
vec![ $( ( From::from($x), From::from($y) ) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! x {
|
|
||||||
( $x:expr ) => {
|
|
||||||
From::from($x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! xx {
|
|
||||||
( $x:expr ) => {
|
|
||||||
From::from(From::from($x))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn state_diff_create_delete() {
|
fn state_diff_create_delete() {
|
||||||
let a = map![
|
let a = map![
|
||||||
|
@ -84,7 +84,7 @@ extern crate time;
|
|||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
#[cfg(feature = "jit" )] extern crate evmjit;
|
#[cfg(feature = "jit" )] extern crate evmjit;
|
||||||
|
|
||||||
extern crate ethcore_util as util;
|
#[macro_use] extern crate ethcore_util as util;
|
||||||
|
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod basic_types;
|
pub mod basic_types;
|
||||||
|
@ -2,13 +2,6 @@ use super::test_common::*;
|
|||||||
use state::*;
|
use state::*;
|
||||||
use ethereum;
|
use ethereum;
|
||||||
|
|
||||||
pub fn hashmap_h256_h256_from_json(json: &Json) -> HashMap<H256, H256> {
|
|
||||||
json.as_object().unwrap().iter().fold(HashMap::new(), |mut m, (key, value)| {
|
|
||||||
m.insert(H256::from(&u256_from_hex(key)), H256::from(&u256_from_json(value)));
|
|
||||||
m
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn map_h256_h256_from_json(json: &Json) -> BTreeMap<H256, H256> {
|
pub fn map_h256_h256_from_json(json: &Json) -> BTreeMap<H256, H256> {
|
||||||
json.as_object().unwrap().iter().fold(BTreeMap::new(), |mut m, (key, value)| {
|
json.as_object().unwrap().iter().fold(BTreeMap::new(), |mut m, (key, value)| {
|
||||||
m.insert(H256::from(&u256_from_hex(key)), H256::from(&u256_from_json(value)));
|
m.insert(H256::from(&u256_from_hex(key)), H256::from(&u256_from_json(value)));
|
||||||
|
Loading…
Reference in New Issue
Block a user