Update tests

This commit is contained in:
Alex Beregszaszi
2020-12-14 19:32:31 +00:00
parent 15237c8404
commit edbdff8619
71 changed files with 214 additions and 219 deletions
@@ -1,5 +1,5 @@
contract c {
byte[10] data1;
bytes1[10] data1;
bytes2[32] data2;
function test() public returns (uint check, uint res1, uint res2) {
uint i;
@@ -7,7 +7,7 @@ contract c {
data2[i] = 0xffff;
check = uint(uint16(data2[31])) * 0x10000 | uint(uint16(data2[14]));
for (i = 0; i < data1.length; ++i)
data1[i] = byte(uint8(1 + i));
data1[i] = bytes1(uint8(1 + i));
data2 = data1;
for (i = 0; i < 16; ++i)
res1 |= uint(uint16(data2[i])) * 0x10000**i;
@@ -1,6 +1,6 @@
contract C {
bytes s;
function f() external returns (byte) {
function f() external returns (bytes1) {
bytes memory data = "abcd";
s = data;
return s[0];
@@ -1,6 +1,6 @@
contract C {
bytes s = "abcd";
function f() external returns (byte) {
function f() external returns (bytes1) {
bytes memory data = s;
return data[0];
}
@@ -4,7 +4,7 @@ contract c {
function f(uint len) public returns (bytes memory) {
bytes memory x = new bytes(len);
for (uint i = 0; i < len; i++)
x[i] = byte(uint8(i));
x[i] = bytes1(uint8(i));
a = x;
for (uint i = 0; i < len; i++)
assert(a[i] == x[i]);
@@ -1,6 +1,6 @@
contract C {
bytes s;
function f(bytes calldata data) external returns (byte) {
function f(bytes calldata data) external returns (bytes1) {
s = data;
return s[0];
}
@@ -1,7 +1,7 @@
contract C {
bytes data;
bytes otherData;
function fromMemory() public returns (byte) {
function fromMemory() public returns (bytes1) {
bytes memory t;
uint[2] memory x;
x[0] = type(uint).max;
@@ -9,12 +9,12 @@ contract C {
data.push();
return data[0];
}
function fromCalldata(bytes calldata x) public returns (byte) {
function fromCalldata(bytes calldata x) public returns (bytes1) {
data = x;
data.push();
return data[0];
}
function fromStorage() public returns (byte) {
function fromStorage() public returns (bytes1) {
// zero-length but dirty higher order bits
assembly { sstore(otherData.slot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) }
data = otherData;