2019-11-07 20:22:58 +00:00
|
|
|
contract C {
|
|
|
|
uint[] storageArray;
|
|
|
|
function test_boundary_check(uint256 len, uint256 access) public returns (uint256)
|
|
|
|
{
|
2019-11-18 13:36:45 +00:00
|
|
|
while(storageArray.length < len)
|
|
|
|
storageArray.push();
|
|
|
|
while(storageArray.length > len)
|
|
|
|
storageArray.pop();
|
2019-11-07 20:22:58 +00:00
|
|
|
return storageArray[access];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ====
|
|
|
|
// compileViaYul: true
|
|
|
|
// ----
|
|
|
|
// test_boundary_check(uint256, uint256): 10, 11 -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 10, 9 -> 0
|
|
|
|
// test_boundary_check(uint256, uint256): 1, 9 -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 1, 1 -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 10, 10 -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 256, 256 -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 256, 255 -> 0
|
|
|
|
// test_boundary_check(uint256, uint256): 256, 0xFFFF -> FAILURE
|
|
|
|
// test_boundary_check(uint256, uint256): 256, 2 -> 0
|