For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
PropTest
struct PropTest
A property test runner.
Implemented traits
Methods
__init__
def __init__(out self)
Construct a new property test runner with the default configuration.
Returns:
Self: A new property test runner with the default configuration.
def __init__(out self, *, var config: PropTestConfig)
Construct a new property test runner.
Args:
- config (
PropTestConfig): The configuration for the property test.
test
def test[StrategyType: Strategy](self, var strategy: StrategyType, f: T)
Run a property test with the given strategy.
Parameters:
- StrategyType (
Strategy): The strategy type to use for the property test.
Args:
- strategy (
StrategyType): The strategy value to use for the property test. - f (
T): The function to test. It is called once per run with a value drawn fromstrategy, and fails the test by raising.
Raises:
An error if the property test fails.