Example
withdrawalAmount that adhere to the bounds set by the vm.assume() constraints.
Use
vm.assume() to filter out invalid inputs that would cause the test to fail for reasons unrelated to your assertion logic.Best Practices
- Set reasonable bounds - Use
vm.assume()to constrain inputs to valid ranges - Test multiple parameters - Fuzz multiple inputs simultaneously to catch interaction bugs
- Use meaningful ranges - Consider the actual values your protocol will encounter
- Check valid edge cases - Ensure assertions pass for valid edge cases
Running Fuzz Tests
Fuzz tests run automatically withpcl test:
foundry.toml:
- Testing Assertions - Basic testing guide
- CI/CD Integration - Automate your tests
- Forge Fuzz Testing Documentation

