Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
test: add test
  • Loading branch information
antazoey committed Jul 8, 2024
1 parent 4bcd15d commit d892c93
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,14 @@ def run_test(manifest):
all_latest_03 = [
c for c in manifest.compilers if str(c.version) == str(VERSION_FROM_PRAGMA)
]
evm_latest = [c for c in all_latest_03 if c.settings.get("evmVersion") == "paris"][0]
codesize_latest = [
evm_opt = [c for c in all_latest_03 if c.settings.get("evmVersion") == "paris"][0]
gas_opt = [c for c in all_latest_03 if c.settings["optimize"] == "gas"][0]
true_opt = [
c
for c in manifest.compilers
if c.settings["optimize"] is True and "non_payable_default" in c.contractTypes
][0]
codesize_opt = [
c
for c in all_latest_03
if c.settings["optimize"] == "codesize" and c.settings.get("evmVersion") != "paris"
Expand All @@ -187,20 +193,23 @@ def run_test(manifest):
c for c in manifest.compilers if str(c.version) == str(OLDER_VERSION_FROM_PRAGMA)
][0]

for compiler in (vyper_028, codesize_latest):
for compiler in (vyper_028, codesize_opt):
assert compiler.name == "vyper"

assert vyper_028.settings["evmVersion"] == "berlin"
assert codesize_latest.settings["evmVersion"] == "shanghai"
assert codesize_opt.settings["evmVersion"] == "shanghai"

# There is only one contract with evm-version pragma.
assert evm_latest.contractTypes == ["evm_pragma"]
assert evm_latest.settings.get("evmVersion") == "paris"
assert evm_opt.contractTypes == ["evm_pragma"]
assert evm_opt.settings.get("evmVersion") == "paris"

assert len(codesize_latest.contractTypes) >= 9
assert len(codesize_opt.contractTypes) == 1
assert len(gas_opt.contractTypes) >= 9
assert len(vyper_028.contractTypes) >= 1
assert "contract_0310" in codesize_latest.contractTypes
assert "optimize_codesize" in codesize_opt.contractTypes
assert "older_version" in vyper_028.contractTypes
assert "contract_0310" in gas_opt.contractTypes
assert "non_payable_default" in true_opt.contractTypes

project.update_manifest(compilers=[])
project.load_contracts(use_cache=False)
Expand Down

0 comments on commit d892c93

Please sign in to comment.