Moving some byte array pop tests to semanticTests.

This commit is contained in:
Djordje Mijovic
2020-11-13 12:32:39 +01:00
parent 31981bad12
commit 29d480d0ed
4 changed files with 57 additions and 75 deletions
@@ -0,0 +1,21 @@
contract c {
uint256 a;
uint256 b;
uint256 c;
bytes data;
function test() public returns (bool) {
for (uint8 i = 0; i <= 40; i++)
data.push(byte(i+1));
for (int8 j = 40; j >= 0; j--) {
require(data[uint8(j)] == byte(j+1));
require(data.length == uint8(j+1));
data.pop();
}
return true;
}
}
// ====
// compileViaYul: also
// ----
// test() -> true
// storage: empty
@@ -0,0 +1,20 @@
contract c {
uint256 a;
uint256 b;
bytes data;
function test() public {
for (uint8 i = 0; i <= 40; i++)
data.push(0x03);
for (uint8 j = 0; j <= 40; j++) {
assembly {
mstore(0, "garbage")
}
data.pop();
}
}
}
// ====
// compileViaYul: also
// ----
// test() ->
// storage: empty
@@ -0,0 +1,16 @@
contract c {
bytes data;
function test() public {
data.push(0x07);
data.push(0x05);
data.push(0x03);
data.pop();
data.pop();
data.pop();
}
}
// ====
// compileViaYul: also
// ----
// test() ->
// storage: empty