Merge branch 'master' of github.com:gavofyork/ethcore-util
This commit is contained in:
21
src/trie.rs
21
src/trie.rs
@@ -740,8 +740,11 @@ impl Trie for TrieDB {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
extern crate json_tests;
|
||||
use self::json_tests::*;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use triehash::*;
|
||||
use hash::*;
|
||||
use super::*;
|
||||
use nibbleslice::*;
|
||||
use rlp;
|
||||
@@ -1080,4 +1083,22 @@ mod tests {
|
||||
|
||||
test_all(v);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_trie_json() {
|
||||
println!("Json trie test: ");
|
||||
execute_tests_from_directory::<trie::TrieTest, _>("json-tests/json/trie/*.json", &mut | file, input, output | {
|
||||
println!("file: {}", file);
|
||||
|
||||
let mut t = TrieDB::new_memory();
|
||||
for operation in input.into_iter() {
|
||||
match operation {
|
||||
trie::Operation::Insert(key, value) => t.insert(&key, &value),
|
||||
trie::Operation::Remove(key) => t.remove(&key)
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(*t.root(), H256::from_slice(&output));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ mod tests {
|
||||
use triehash::*;
|
||||
|
||||
#[test]
|
||||
fn test_trie_out_of_order() {
|
||||
fn test_triehash_out_of_order() {
|
||||
assert!(trie_root(vec![
|
||||
(vec![0x01u8, 0x23], vec![0x01u8, 0x23]),
|
||||
(vec![0x81u8, 0x23], vec![0x81u8, 0x23]),
|
||||
@@ -297,7 +297,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_trie_json() {
|
||||
fn test_triehash_json() {
|
||||
execute_tests_from_directory::<trie::TriehashTest, _>("json-tests/json/trie/*.json", &mut | file, input, output | {
|
||||
println!("file: {}, output: {:?}", file, output);
|
||||
assert_eq!(trie_root(input), H256::from_slice(&output));
|
||||
|
||||
Reference in New Issue
Block a user