Fiddling with tests.
This commit is contained in:
parent
c1c3152094
commit
6ba9af18e9
@ -393,7 +393,7 @@ impl TrieDB {
|
|||||||
(true, i) if orig.at(i).is_empty() => // easy - original had empty slot.
|
(true, i) if orig.at(i).is_empty() => // easy - original had empty slot.
|
||||||
diff.new_node(Self::compose_leaf(&partial.mid(1), value), &mut s),
|
diff.new_node(Self::compose_leaf(&partial.mid(1), value), &mut s),
|
||||||
(true, i) => { // harder - original has something there already
|
(true, i) => { // harder - original has something there already
|
||||||
let new = self.augmented(orig.at(i).raw(), &partial.mid(1), value, diff);
|
let new = self.augmented(self.take_node(&orig.at(i), diff), &partial.mid(1), value, diff);
|
||||||
diff.replace_node(&orig.at(i), new, &mut s);
|
diff.replace_node(&orig.at(i), new, &mut s);
|
||||||
}
|
}
|
||||||
(false, i) => { s.append_raw(orig.at(i).raw(), 1); },
|
(false, i) => { s.append_raw(orig.at(i).raw(), 1); },
|
||||||
@ -472,7 +472,7 @@ impl TrieDB {
|
|||||||
trace!("empty: COMPOSE");
|
trace!("empty: COMPOSE");
|
||||||
Self::compose_leaf(partial, value)
|
Self::compose_leaf(partial, value)
|
||||||
},
|
},
|
||||||
_ => panic!("Invalid RLP for node."),
|
_ => panic!("Invalid RLP for node: {:?}", old.pretty()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,11 +591,12 @@ mod tests {
|
|||||||
fn test_at_dog() {
|
fn test_at_dog() {
|
||||||
env_logger::init().ok();
|
env_logger::init().ok();
|
||||||
let mut t = TrieDB::new_memory();
|
let mut t = TrieDB::new_memory();
|
||||||
let v: Vec<(Vec<u8>, Vec<u8>)> = vec![
|
let mut v: Vec<(Vec<u8>, Vec<u8>)> = vec![
|
||||||
(From::from("do"), From::from("verb")),
|
(From::from("do"), From::from("verb")),
|
||||||
(From::from("dog"), From::from("puppy")),
|
(From::from("dog"), From::from("puppy")),
|
||||||
(From::from("doge"), From::from("coin")),
|
(From::from("doge"), From::from("coin")),
|
||||||
(From::from("horse"), From::from("stallion")),
|
(From::from("horse"), From::from("stallion")),
|
||||||
|
(From::from("dot"), From::from("point")),
|
||||||
];
|
];
|
||||||
|
|
||||||
for i in 0..v.len() {
|
for i in 0..v.len() {
|
||||||
@ -606,6 +607,7 @@ mod tests {
|
|||||||
|
|
||||||
// trace!("{:?}", t);
|
// trace!("{:?}", t);
|
||||||
|
|
||||||
|
v.sort();
|
||||||
assert_eq!(*t.root(), trie_root(v));
|
assert_eq!(*t.root(), trie_root(v));
|
||||||
|
|
||||||
/*for i in 0..v.len() {
|
/*for i in 0..v.len() {
|
||||||
|
Loading…
Reference in New Issue
Block a user