2019-06-13 15:22:24 +00:00
|
|
|
contract C {
|
2019-09-18 13:38:38 +00:00
|
|
|
uint[] storageArray;
|
|
|
|
function test_indices(uint256 len) public
|
|
|
|
{
|
2019-11-07 20:22:58 +00:00
|
|
|
// storageArray = new uint[](len);
|
|
|
|
while (storageArray.length < len) storageArray.push();
|
|
|
|
while (storageArray.length > len) storageArray.pop();
|
2019-09-18 13:38:38 +00:00
|
|
|
for (uint i = 0; i < len; i++)
|
|
|
|
storageArray[i] = i + 1;
|
2019-06-13 15:22:24 +00:00
|
|
|
|
2019-09-18 13:38:38 +00:00
|
|
|
for (uint i = 0; i < len; i++)
|
|
|
|
require(storageArray[i] == i + 1);
|
|
|
|
}
|
2019-06-13 15:22:24 +00:00
|
|
|
}
|
2019-11-07 20:22:58 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: true
|
2019-06-13 15:22:24 +00:00
|
|
|
// ----
|
2019-09-18 13:38:38 +00:00
|
|
|
// test_indices(uint256): 1 ->
|
|
|
|
// test_indices(uint256): 129 ->
|
|
|
|
// test_indices(uint256): 5 ->
|
|
|
|
// test_indices(uint256): 10 ->
|
|
|
|
// test_indices(uint256): 15 ->
|
|
|
|
// test_indices(uint256): 0xFF ->
|
|
|
|
// test_indices(uint256): 1000 ->
|
|
|
|
// test_indices(uint256): 129 ->
|
|
|
|
// test_indices(uint256): 128 ->
|
|
|
|
// test_indices(uint256): 1 ->
|