Random tests.

This commit is contained in:
Gav Wood 2015-12-02 02:44:45 +01:00
parent fbab7f3cf3
commit 706428acbe

View File

@ -190,9 +190,12 @@ fn hash256rlp(input: &[(Vec<u8>, Vec<u8>)], pre_len: usize, stream: &mut RlpStre
// iterate over all possible nibbles // iterate over all possible nibbles
for i in 0..16 { for i in 0..16 {
// cout how many successive elements have same next nibble // cout how many successive elements have same next nibble
let len = input[begin..].iter() let len = match begin < input.len() {
.map(| pair | pair.0[pre_len] ) true => input[begin..].iter()
.take_while(|&q| q == i).count(); .map(| pair | pair.0[pre_len] )
.take_while(|&q| q == i).count(),
false => 0
};
// if at least 1 successive element has the same nibble // if at least 1 successive element has the same nibble
// append their suffixes // append their suffixes