Skip to content

Commit

Permalink
Test empty disktreemap
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKickliter committed Feb 26, 2024
1 parent bbc9fcf commit 1b86529
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/disktree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,16 @@ mod tests {
"iterating a disktree should yield identically ordered elements as the hextree tree it was derived from"
);
}

#[test]
fn test_empty_disktree() {
use crate::HexTreeMap;
use std::io::Cursor;
let mut wtr = vec![];
HexTreeMap::<&[u8]>::new()
.to_disktree(Cursor::new(&mut wtr), |wtr, val| wtr.write_all(val))
.unwrap();
let disktree = DiskTreeMap::with_buf(wtr).unwrap();
assert_eq!(0, disktree.iter().unwrap().count());
}
}

0 comments on commit 1b86529

Please sign in to comment.