BTreeMap: make test cases more explicit on failure

This commit is contained in:
Stein Somers 2020-11-18 18:19:38 +01:00
parent c34c015fe2
commit 9e618bacf2
2 changed files with 9 additions and 5 deletions

View File

@ -115,7 +115,7 @@ fn assert_strictly_ascending(&self)
impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
fn assert_min_len(self, min_len: usize) {
assert!(self.len() >= min_len, "{} < {}", self.len(), min_len);
assert!(self.len() >= min_len, "node len {} < {}", self.len(), min_len);
if let node::ForceResult::Internal(node) = self.force() {
for idx in 0..=node.len() {
let edge = unsafe { Handle::new_edge(node, idx) };

View File

@ -30,11 +30,15 @@ pub fn dump_keys(self) -> String
let depth = self.height();
let indent = " ".repeat(depth);
result += &format!("\n{}", indent);
for idx in 0..leaf.len() {
if idx > 0 {
result += ", ";
if leaf.len() == 0 {
result += "(empty node)";
} else {
for idx in 0..leaf.len() {
if idx > 0 {
result += ", ";
}
result += &format!("{:?}", unsafe { leaf.key_at(idx) });
}
result += &format!("{:?}", unsafe { leaf.key_at(idx) });
}
}
navigate::Position::Internal(_) => {}