Move macros to util.

This commit is contained in:
Gav Wood 2016-01-13 23:07:01 +01:00
parent 78b10fd5f2
commit 08824e3ece
3 changed files with 1 additions and 32 deletions

View File

@ -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()
}
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]
fn state_diff_create_delete() {
let a = map![

View File

@ -84,7 +84,7 @@ extern crate time;
extern crate env_logger;
#[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 basic_types;

View File

@ -2,13 +2,6 @@ use super::test_common::*;
use state::*;
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> {
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)));