mirror of
https://github.com/crytic/echidna.git
synced 2026-10-12 02:12:32 +00:00
* feat: add explicit verification test mode * fix: respect sequence length in Foundry filtering * test: use explicit verification mode for symbolic assertions * foundry fixes * test: add missing testFail regression test files The contract and config used by the "foundry/TestFail.sol" test case were left out of the previous commit, making the test fail on CI with a missing config file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GWXznupnma5sEUJ7NrLDvi * fix: fuzz check and prove functions in Foundry mode "check" and "prove" functions are symbolic entry points, but a Foundry mode campaign is a fuzzing campaign: symbolic execution is only used when it is enabled, so these functions must be fuzzed like any other test function. Before this, a stateless Foundry campaign (seqLen == 1) would neither call nor check them, silently testing nothing for contracts whose properties all use those prefixes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GWXznupnma5sEUJ7NrLDvi * test: cover stateful and reverting check/prove functions The stateless case was the only one covered: add a stateful campaign, where parameterless "check" and "prove" functions are checked after each transaction, and a "check" function that reverts, which is a failure like it is for any other test function. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GWXznupnma5sEUJ7NrLDvi --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
22 lines
717 B
Solidity
22 lines
717 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
// Foundry "testFail" functions are expected to revert, so their outcome is
|
|
// inverted: they fail when the call succeeds. No forge-std needed here, the
|
|
// convention is purely about the function name.
|
|
contract TestFailTest {
|
|
function IS_TEST() public pure returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
// Always reverts, so this test passes
|
|
function testFail_always_reverts(uint256) public pure {
|
|
revert("expected revert");
|
|
}
|
|
|
|
// Succeeds for any input above 100, breaking the expectation that a
|
|
// "testFail" function always reverts
|
|
function testFail_sometimes_reverts(uint256 x) public pure {
|
|
require(x > 100, "expected revert");
|
|
}
|
|
}
|