add another btree test
Some checks failed
Rust CI / Test Suite (push) Failing after 3s
Rust CI / Clippy (push) Failing after 2s

This commit is contained in:
Christoph J. Scherr 2025-06-04 21:38:47 +02:00
parent d63222a6ef
commit 562ba1eaef
Signed by: PlexSheep
GPG key ID: 9EB784BB202BB7BB

View file

@ -153,7 +153,7 @@ mod test {
}
#[test]
fn test_insert() {
fn test_insert_easy() {
let mut tree = BTree::<u32>::new(DEFAULT_DEGREE);
let data = &[19, 125, 25, 16, 2, 73, 384, 435, 12924, 42, 125251, 2548];
@ -165,4 +165,25 @@ mod test {
assert!(tree.has(*d))
}
}
#[test]
fn test_insert_many() {
let mut tree = BTree::<u32>::new(DEFAULT_DEGREE);
let mut data = vec![19, 125, 25, 16, 2, 73, 384, 435, 12924, 42, 125251, 2548];
for _ in 0..10 {
data.extend(data.clone());
}
// data has 12288 elements here! This is a lot, but should be reasonably possible for a btree.
println!("len of data: {}", data.len());
for d in &data {
tree.insert(*d)
}
for d in &data {
assert!(tree.has(*d))
}
}
}