solidity/test/libsolidity/semanticTests/viaYul/array_storage_index_boundery_test.sol
2019-06-20 16:14:51 +02:00

22 lines
752 B
Solidity

contract C {
uint[] storageArray;
function test_boundery_check(uint256 len, uint256 access) public returns
(uint256)
{
storageArray.length = len;
return storageArray[access];
}
}
// ====
// compileViaYul: true
// ----
// test_boundery_check(uint256, uint256): 10, 11 -> FAILURE
// test_boundery_check(uint256, uint256): 10, 9 -> 0
// test_boundery_check(uint256, uint256): 1, 9 -> FAILURE
// test_boundery_check(uint256, uint256): 1, 1 -> FAILURE
// test_boundery_check(uint256, uint256): 10, 10 -> FAILURE
// test_boundery_check(uint256, uint256): 256, 256 -> FAILURE
// test_boundery_check(uint256, uint256): 256, 255 -> 0
// test_boundery_check(uint256, uint256): 256, 0xFFFF -> FAILURE
// test_boundery_check(uint256, uint256): 256, 2 -> 0