mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
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.
21 lines
510 B
21 lines
510 B
5 years ago
|
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)
|