Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/btreemap/proptests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,58 @@ fn comprehensive_cached(#[strategy(pvec(operation_strategy(), 100..5_000))] ops:
}
}

fn run_comprehensive(ops: Vec<Operation>, cache_slots: usize) {
let mem = make_memory();
let mut btree = BTreeMap::new(mem).with_node_cache(cache_slots);
let mut std_btree = StdBTreeMap::new();

for op in ops.into_iter() {
execute_operation(&mut std_btree, &mut btree, op);
}
}

// Cache-parameterized variants: run the same comprehensive operation sequence
// at different cache sizes to catch size-dependent correctness bugs.
// Includes non-power-of-two sizes — users can pass any value to with_node_cache.
// Fewer cases per variant to keep total runtime reasonable.

#[proptest(cases = 3)]
fn comprehensive_cache_0(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 0);
}

#[proptest(cases = 3)]
fn comprehensive_cache_1(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 1);
}

#[proptest(cases = 3)]
fn comprehensive_cache_3(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 3);
}

#[proptest(cases = 3)]
fn comprehensive_cache_7(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 7);
}

#[proptest(cases = 3)]
fn comprehensive_cache_16(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 16);
}

#[proptest(cases = 3)]
fn comprehensive_cache_50(#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>) {
run_comprehensive(ops, 50);
}

#[proptest(cases = 3)]
fn comprehensive_cache_256(
#[strategy(pvec(operation_strategy(), 100..5_000))] ops: Vec<Operation>,
) {
run_comprehensive(ops, 256);
}

// A comprehensive fuzz test that runs until it's explicitly terminated. To run:
//
// ```
Expand Down
Loading
Loading