Skip to content

Commit

Permalink
Merge pull request #41 from JayKickliter/jsk/disktree/add-empty-test
Browse files Browse the repository at this point in the history
Test empty disktreemap
  • Loading branch information
JayKickliter committed Feb 27, 2024
2 parents bbc9fcf + 1b86529 commit 5f9d1c3
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 5f9d1c3

Please sign in to comment.