foundry_evm_fuzz::strategies::param

Function fuzz_param_with_fixtures

Source
pub fn fuzz_param_with_fixtures(
    param: &DynSolType,
    fixtures: Option<&[DynSolValue]>,
    name: &str,
) -> BoxedStrategy<DynSolValue>
Expand description

Given a parameter type and configured fixtures for param name, returns a strategy for generating values for that type.

Fixtures can be currently generated for uint, int, address, bytes and string types and are defined for parameter name. For example, fixtures for parameter owner of type address can be defined in a function with a function fixture_owner() public returns (address[] memory) signature.

Fixtures are matched on parameter name, hence fixtures defined in fixture_owner function can be used in a fuzzed test function with a signature like function testFuzz_ownerAddress(address owner, uint amount).

Raises an error if all the fixture types are not of the same type as the input parameter.

Works with ABI Encoder v2 tuples.