Skip to content

Commit

Permalink
add shuffle test for get
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Oct 19, 2023
1 parent 2f44abe commit ef13279
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/store/src/avl/tests.rs
Original file line number Diff line number Diff line change
@@ -40,6 +40,23 @@ fn get() {
assert_eq!(tree.get(&[4]), None);
}

#[test]
fn shuffle_get() {
let mut tree = AvlTree::new();

let mut keys: Vec<u8> = (0..100).collect();

keys.shuffle(&mut thread_rng());
for &i in keys.iter() {
tree.insert([i], vec![i]);
}

keys.shuffle(&mut thread_rng());
for &i in keys.iter() {
assert_eq!(tree.get(&[i]), Some(&vec![i]));
}
}

#[test]
fn shuffle_remove() {
let mut tree = AvlTree::new();

0 comments on commit ef13279

Please sign in to comment.