removed duplicate tests
This commit is contained in:
parent
b9181b42bc
commit
166b84d489
@ -54,7 +54,7 @@ pub fn execute_test_from_file<T, F>(path: &Path, f: &mut F) where T: JsonTest, F
|
||||
f(test.input(), test.output())
|
||||
}
|
||||
|
||||
pub fn execute_tests_in_directory<T, F>(pattern: &str, f: &mut F) where T: JsonTest, F: FnMut(String, T::Input, T::Output) {
|
||||
pub fn execute_tests_from_directory<T, F>(pattern: &str, f: &mut F) where T: JsonTest, F: FnMut(String, T::Input, T::Output) {
|
||||
for path in glob(pattern).unwrap().filter_map(Result::ok) {
|
||||
execute_test_from_file::<T, _>(&path, &mut | input, output | {
|
||||
f(path.to_str().unwrap().to_string(), input, output);
|
||||
@ -62,7 +62,3 @@ pub fn execute_tests_in_directory<T, F>(pattern: &str, f: &mut F) where T: JsonT
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
}
|
||||
|
||||
|
@ -277,29 +277,13 @@ fn test_hex_prefix_encode() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::str::FromStr;
|
||||
use std::collections::HashMap;
|
||||
use rustc_serialize::hex::FromHex;
|
||||
use rustc_serialize::json::Json;
|
||||
use bytes::*;
|
||||
extern crate json_tests;
|
||||
use self::json_tests::*;
|
||||
use hash::*;
|
||||
use triehash::*;
|
||||
|
||||
#[test]
|
||||
fn puppy_trie_items() {
|
||||
|
||||
let v = vec![
|
||||
(From::from("do"), From::from("verb")),
|
||||
(From::from("dog"), From::from("puppy")),
|
||||
(From::from("doge"), From::from("coin")),
|
||||
(From::from("horse"), From::from("stallion")),
|
||||
];
|
||||
|
||||
assert_eq!(trie_root(v), H256::from_str("5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn out_of_order() {
|
||||
fn test_trie_out_of_order() {
|
||||
assert!(trie_root(vec![
|
||||
(vec![0x01u8, 0x23], vec![0x01u8, 0x23]),
|
||||
(vec![0x81u8, 0x23], vec![0x81u8, 0x23]),
|
||||
@ -313,44 +297,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_trie_root() {
|
||||
let v = vec![
|
||||
|
||||
("0000000000000000000000000000000000000000000000000000000000000045".from_hex().unwrap(),
|
||||
"22b224a1420a802ab51d326e29fa98e34c4f24ea".from_hex().unwrap()),
|
||||
|
||||
("0000000000000000000000000000000000000000000000000000000000000046".from_hex().unwrap(),
|
||||
"67706c2076330000000000000000000000000000000000000000000000000000".from_hex().unwrap()),
|
||||
|
||||
("000000000000000000000000697c7b8c961b56f675d570498424ac8de1a918f6".from_hex().unwrap(),
|
||||
"6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000".from_hex().unwrap()),
|
||||
|
||||
("0000000000000000000000007ef9e639e2733cb34e4dfc576d4b23f72db776b2".from_hex().unwrap(),
|
||||
"4655474156000000000000000000000000000000000000000000000000000000".from_hex().unwrap()),
|
||||
|
||||
("000000000000000000000000ec4f34c97e43fbb2816cfd95e388353c7181dab1".from_hex().unwrap(),
|
||||
"4e616d6552656700000000000000000000000000000000000000000000000000".from_hex().unwrap()),
|
||||
|
||||
("4655474156000000000000000000000000000000000000000000000000000000".from_hex().unwrap(),
|
||||
"7ef9e639e2733cb34e4dfc576d4b23f72db776b2".from_hex().unwrap()),
|
||||
|
||||
("4e616d6552656700000000000000000000000000000000000000000000000000".from_hex().unwrap(),
|
||||
"ec4f34c97e43fbb2816cfd95e388353c7181dab1".from_hex().unwrap()),
|
||||
|
||||
("6f6f6f6820736f2067726561742c207265616c6c6c793f000000000000000000".from_hex().unwrap(),
|
||||
"697c7b8c961b56f675d570498424ac8de1a918f6".from_hex().unwrap())
|
||||
|
||||
];
|
||||
|
||||
assert_eq!(trie_root(v), H256::from_str("9f6221ebb8efe7cff60a716ecb886e67dd042014be444669f0159d8e68b42100").unwrap());
|
||||
}
|
||||
|
||||
extern crate json_tests;
|
||||
use self::json_tests::*;
|
||||
|
||||
#[test]
|
||||
fn run_trie_tests() {
|
||||
execute_tests_in_directory::<trie::TriehashTest, _>("json-tests/json/trie/*.json", &mut | file, input, output | {
|
||||
fn test_trie_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));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user