Skip to content

Commit 140058b

Browse files
committed
test: drive proptest cases and max_shrink_iters from env vars, defaulting to 512/1000
Signed-off-by: azjezz <azjezz@protonmail.com>
1 parent e3358a5 commit 140058b

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

‎tests/property_lattice.rs‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,30 @@ fn subtract_of(a: TypeId, b: TypeId, w: &MockWorld) -> TypeId {
520520
subtract::compute(a, b, w, LatticeOptions::default(), &mut report)
521521
}
522522

523+
fn env_cases() -> u32 {
524+
std::env::var("SUFFETE_PROPTEST_CASES").ok().and_then(|v| v.parse().ok()).unwrap_or(512)
525+
}
526+
527+
fn env_max_shrink_iters() -> u32 {
528+
std::env::var("SUFFETE_PROPTEST_MAX_SHRINK_ITERS").ok().and_then(|v| v.parse().ok()).unwrap_or(1000)
529+
}
530+
531+
fn env_max_global_rejects(cases: u32) -> u32 {
532+
std::env::var("SUFFETE_PROPTEST_MAX_GLOBAL_REJECTS")
533+
.ok()
534+
.and_then(|v| v.parse().ok())
535+
.unwrap_or(1024.max(cases.saturating_mul(2)))
536+
}
537+
523538
proptest! {
524-
#![proptest_config(ProptestConfig {
525-
cases: 512,
526-
max_shrink_iters: 1000,
527-
..ProptestConfig::default()
539+
#![proptest_config({
540+
let cases = env_cases();
541+
ProptestConfig {
542+
cases,
543+
max_shrink_iters: env_max_shrink_iters(),
544+
max_global_rejects: env_max_global_rejects(cases),
545+
..ProptestConfig::default()
546+
}
528547
})]
529548

530549
#[test]

0 commit comments

Comments
 (0)