Merge branch 'master' of github.com:gavofyork/ethcore-util

This commit is contained in:
Gav Wood 2015-11-27 13:18:10 +01:00
commit c08292663f
4 changed files with 17 additions and 13 deletions

View File

@ -13,4 +13,5 @@ rustc-serialize = "0.3"
arrayvec = "0.3" arrayvec = "0.3"
mio = "0.*" mio = "0.*"
rand = "0.*" rand = "0.*"
tiny-keccak = "0.1" tiny-keccak = "0.2"
rocksdb = "0.2.1"

0
src/db.rs Normal file
View File

View File

@ -95,23 +95,23 @@ macro_rules! impl_hash {
} }
} }
impl_hash!(Hash64, 8); impl_hash!(H64, 8);
impl_hash!(Hash128, 16); impl_hash!(H128, 16);
impl_hash!(Address, 20); impl_hash!(Address, 20);
impl_hash!(Hash256, 32); impl_hash!(H256, 32);
impl_hash!(Hash512, 64); impl_hash!(H512, 64);
impl_hash!(Hash520, 65); impl_hash!(H520, 65);
impl_hash!(Hash1024, 128); impl_hash!(H1024, 128);
impl_hash!(Hash2048, 256); impl_hash!(H2048, 256);
impl_hash!(Hash4096, 512); impl_hash!(H4096, 512);
#[test] #[test]
fn hash() { fn hash() {
let h = Hash64([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]); let h = H64([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]);
assert_eq!(Hash64::from_str("0123456789abcdef").unwrap(), h); assert_eq!(H64::from_str("0123456789abcdef").unwrap(), h);
assert_eq!(format!("{}", h), "0123456789abcdef"); assert_eq!(format!("{}", h), "0123456789abcdef");
assert_eq!(format!("{:?}", h), "0123456789abcdef"); assert_eq!(format!("{:?}", h), "0123456789abcdef");
assert!(h == h); assert!(h == h);
assert!(h != Hash64([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xee])); assert!(h != H64([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xee]));
assert!(h != Hash64([0; 8])); assert!(h != H64([0; 8]));
} }

View File

@ -1,6 +1,8 @@
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate mio; extern crate mio;
extern crate rand; extern crate rand;
extern crate rocksdb;
extern crate tiny_keccak;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
@ -12,6 +14,7 @@ pub mod uint;
pub mod bytes; pub mod bytes;
pub mod rlp; pub mod rlp;
pub mod vector; pub mod vector;
pub mod db;
//pub mod network; //pub mod network;