Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
mythril/tests/laser/strategy/test_loop_bound.py

20 lines
510 B

import pytest
from mythril.laser.ethereum.strategy.extensions.bounded_loops import (
BoundedLoopsStrategy,
)
@pytest.mark.parametrize(
"trace, count",
[
([6, 7, 7, 7], 3),
([6, 8, 6, 7, 6, 7, 6, 7, 6, 7], 4),
([6, 6, 6, 6], 4),
([6, 7, 8] * 10, 10),
([7, 9, 10] + list(range(1, 100)) * 100, 100),
([7, 10, 15], 0),
([7] * 100, 100),
],
)
def test_loop_count(trace, count):
assert count == BoundedLoopsStrategy.get_loop_count(trace)