Skip to content

Commit

Permalink
update test to check nested array length
Browse files Browse the repository at this point in the history
  • Loading branch information
Troublor committed Mar 21, 2023
1 parent 25fe3e7 commit aa4ce6e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_ssa_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def test_issue_1776():
source = """
contract Contract {
function foo() public returns (uint) {
uint[] memory arr = new uint[](2);
uint[5][10][] memory arr = new uint[5][10][](2);
return 0;
}
}
Expand All @@ -1094,5 +1094,13 @@ def test_issue_1776():
c = slither.get_contract_from_name("Contract")[0]
f = c.functions[0]
operations = f.slithir_operations
assign_op = operations[0]
assert isinstance(assign_op.lvalue.type, ArrayType)
new_op = operations[0]
lvalue = new_op.lvalue
lvalue_type = lvalue.type
assert isinstance(lvalue_type, ArrayType)
lvalue_type1 = lvalue_type.type
assert isinstance(lvalue_type1, ArrayType)
assert lvalue_type1.length_value.value == "10"
lvalue_type2 = lvalue_type1.type
assert isinstance(lvalue_type2, ArrayType)
assert lvalue_type2.length_value.value == "5"

0 comments on commit aa4ce6e

Please sign in to comment.