solidity/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol
Alex Beregszaszi 159f50e189 Turn on semantic tests for the old codegen where possible
These were marked IR-only, but they do pass on the old codegen too.

Also add old codegen version of semantictests/revertStrings/function_entry_checks.
2020-11-25 14:33:39 +00:00

29 lines
773 B
Solidity

contract C {
uint[] storageArray;
function test_indices(uint256 len) public
{
while (storageArray.length < len)
storageArray.push();
while (storageArray.length > len)
storageArray.pop();
for (uint i = 0; i < len; i++)
storageArray[i] = i + 1;
for (uint i = 0; i < len; i++)
require(storageArray[i] == i + 1);
}
}
// ====
// compileViaYul: also
// ----
// 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 ->