mirror of https://github.com/ConsenSys/mythril
Fix string loop errors (#1370)
* Fix off by one errors and add tests * Add type hints Co-authored-by: Bernhard Mueller <b-mueller@users.noreply.github.com>pull/1372/head
parent
c99555d69b
commit
1ddfc598be
@ -0,0 +1,20 @@ |
||||
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) |
Loading…
Reference in new issue