-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2574 from crytic/dev-echidna-values
Echidna printer Improve values extraction
- Loading branch information
Showing
4 changed files
with
272 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pathlib import Path | ||
|
||
from slither import Slither | ||
from slither.printers.guidance.echidna import _extract_constants, ConstantValue | ||
|
||
TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data" | ||
|
||
|
||
def test_enum_max_min(solc_binary_path) -> None: | ||
solc_path = solc_binary_path("0.8.19") | ||
slither = Slither(Path(TEST_DATA_DIR, "constantfolding.sol").as_posix(), solc=solc_path) | ||
|
||
contracts = slither.get_contract_from_name("A") | ||
|
||
constants = _extract_constants(contracts)[0]["A"]["use()"] | ||
|
||
assert set(constants) == { | ||
ConstantValue(value="2", type="uint256"), | ||
ConstantValue(value="10", type="uint256"), | ||
ConstantValue(value="100", type="uint256"), | ||
ConstantValue(value="4294967295", type="uint32"), | ||
} |
Oops, something went wrong.