forall
def forall[T: ImplicitlyCopyable & Deinitable](prop: def(T) raises thin -> Bool, gen: def(mut Xoshiro256) thin -> T, minimize_fn: def(T) thin -> List[T], trials: Int = Int(1000), seed: UInt64 = UInt64(0)) Test a boolean property over trials random values of type T.
When a counterexample is found, minimize_fn is called iteratively to
minimize it before the error is raised.
- Parameters
T: Type of the generated value (must beImplicitlyCopyableandDeinitable;ImplicitlyCopyablealready impliesMovable).
- Args
prop: The property predicate. ReturnFalseor raise to signal a counterexample.gen: Generator function --def(mut Xoshiro256) -> T.minimize_fn: Minimizer --def(T) -> List[T]. Called to minimize the counterexample before raising.trials: Number of random trials (default 1 000).seed: PRNG seed (0 = derive from stack address).
Raises Error: If a counterexample is found (after minimization).