From 46d5f5ec4d039e0883832cd45d08cb03f43840d8 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 29 Dec 2023 11:43:16 +0400 Subject: Add randomized border to proptest --- src/layout/mod.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 07e216e2..9c3fb66b 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -2186,6 +2186,10 @@ mod tests { check_ops_with_options(options, &ops); } + fn arbitrary_border() -> impl Strategy { + prop_oneof![Just(0), (1..=u16::MAX)] + } + proptest! { #![proptest_config(ProptestConfig { cases: if std::env::var_os("RUN_SLOW_TESTS").is_none() { @@ -2198,9 +2202,15 @@ mod tests { })] #[test] - fn random_operations_dont_panic(ops: Vec) { + fn random_operations_dont_panic(ops: Vec, border in arbitrary_border()) { + let mut options = Options::default(); + if border != 0 { + options.border.off = false; + options.border.width = border; + } + // eprintln!("{ops:?}"); - check_ops(&ops); + check_ops_with_options(options, &ops); } } } -- cgit