solidity/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol
Alex Beregszaszi 0b6f87ef3c Update tests
2021-05-31 10:43:18 +01:00

27 lines
676 B
Solidity

contract C {
uint256[] storageArray;
function pushEmpty(uint256 len) public {
while(storageArray.length < len)
storageArray.push();
for (uint i = 0; i < len; i++)
require(storageArray[i] == 0);
}
}
// ====
// EVMVersion: >=petersburg
// compileViaYul: also
// ----
// pushEmpty(uint256): 128
// gas irOptimized: 430912
// gas legacy: 417282
// gas legacyOptimized: 399043
// pushEmpty(uint256): 256
// gas irOptimized: 732164
// gas legacy: 715078
// gas legacyOptimized: 688903
// pushEmpty(uint256): 38869 -> FAILURE # out-of-gas #
// gas irOptimized: 100000000
// gas legacy: 100000000
// gas legacyOptimized: 100000000