Function diem_proptest_helpers::with_stack_size
source · pub fn with_stack_size<'a, F, T>(
size: usize,
f: F
) -> Result<T, Box<dyn Any + Send + 'static>>where
F: FnOnce() -> T + Send + 'a,
T: Send + 'a,
Expand description
Creates a new thread with a larger stack size.
Generating some proptest values can overflow the stack. This allows test authors to work around this limitation.
This is expected to be used with closure-style proptest invocations:
use proptest::prelude::*;
use diem_proptest_helpers::with_stack_size;
with_stack_size(4 * 1024 * 1024, || proptest!(|(x in 0usize..128)| {
// assertions go here
prop_assert!(x >= 0 && x < 128);
}));