Adjust tests.

This commit is contained in:
chriseth
2018-06-25 17:17:18 +02:00
committed by Alex Beregszaszi
parent 23c4142005
commit 86a720b96a
26 changed files with 103 additions and 173 deletions
@@ -1,12 +1,10 @@
contract C {
uint constant a = b * c;
uint constant b = 7;
uint constant c = b + uint(keccak256(d));
uint constant c = b + uint(keccak256(abi.encodePacked(d)));
uint constant d = 2 + a;
}
// ----
// Warning: (98-110): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (98-110): The provided argument of type uint256 is not implicitly convertible to expected type bytes memory.
// TypeError: (17-40): The value of the constant a has a cyclic dependency via c.
// TypeError: (71-111): The value of the constant c has a cyclic dependency via d.
// TypeError: (117-140): The value of the constant d has a cyclic dependency via a.
// TypeError: (71-129): The value of the constant c has a cyclic dependency via d.
// TypeError: (135-158): The value of the constant d has a cyclic dependency via a.
@@ -1,9 +1,7 @@
contract C {
uint constant a = b * c;
uint constant b = 7;
uint constant c = 4 + uint(keccak256(d));
uint constant c = 4 + uint(keccak256(abi.encode(d)));
uint constant d = 2 + b;
}
// ----
// Warning: (98-110): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (98-110): The provided argument of type uint256 is not implicitly convertible to expected type bytes memory.
@@ -1,6 +1,6 @@
contract test {
function f() pure public {
bytes32 x = sha3();
bytes32 x = sha3("");
x;
}
function g() public {
@@ -8,5 +8,5 @@ contract test {
}
}
// ----
// TypeError: (58-64): "sha3" has been deprecated in favour of "keccak256"
// TypeError: (99-150): "suicide" has been deprecated in favour of "selfdestruct"
// TypeError: (58-66): "sha3" has been deprecated in favour of "keccak256"
// TypeError: (101-152): "suicide" has been deprecated in favour of "selfdestruct"
@@ -0,0 +1,5 @@
contract C {
function f() pure public { abi.encode(2**500); }
}
// ----
// TypeError: (55-61): Invalid rational number (too large or division by zero).
@@ -1,7 +0,0 @@
contract C {
function f() public { keccak256(2**500); }
}
// ----
// Warning: (39-56): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (39-56): The provided argument of type int_const 3273...(143 digits omitted)...9376 is not implicitly convertible to expected type bytes memory.
// TypeError: (49-55): Invalid rational number (too large or division by zero).
@@ -2,8 +2,8 @@ contract C {
function f() public {
address addr;
uint balance = addr.balance;
bool callRet = addr.call();
bool delegatecallRet = addr.delegatecall();
bool callRet = addr.call("");
bool delegatecallRet = addr.delegatecall("");
bool sendRet = addr.send(1);
addr.transfer(1);
balance; callRet; delegatecallRet; sendRet;
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function () pure returns (bytes32)
// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32)
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-57): Member "gas" not found or not visible after argument-dependent lookup in function () pure returns (bytes32)
// TypeError: (47-57): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32)
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function () pure returns (bytes20)
// TypeError: (47-60): Member "gas" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes20)
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-62): Member "value" not found or not visible after argument-dependent lookup in function () pure returns (bytes32) - did you forget the "payable" modifier?
// TypeError: (47-62): Member "value" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32) - did you forget the "payable" modifier?
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-59): Member "value" not found or not visible after argument-dependent lookup in function () pure returns (bytes32) - did you forget the "payable" modifier?
// TypeError: (47-59): Member "value" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes32) - did you forget the "payable" modifier?
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (47-62): Member "value" not found or not visible after argument-dependent lookup in function () pure returns (bytes20) - did you forget the "payable" modifier?
// TypeError: (47-62): Member "value" not found or not visible after argument-dependent lookup in function (bytes memory) pure returns (bytes20) - did you forget the "payable" modifier?
@@ -7,9 +7,6 @@ contract C {
function g(bytes32) pure internal {}
}
// ----
// Warning: (54-72): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (54-72): The provided argument of type uint256 is not implicitly convertible to expected type bytes memory.
// Warning: (85-100): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (85-100): The provided argument of type uint256 is not implicitly convertible to expected type bytes memory.
// Warning: (113-131): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (113-131): The provided argument of type uint256 is not implicitly convertible to expected type bytes memory.
// TypeError: (64-71): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested.
// TypeError: (92-99): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested.
// TypeError: (123-130): Invalid type for argument in function call. Invalid implicit conversion from uint256 to bytes memory requested.
@@ -1,13 +1,13 @@
contract C {
function f() public pure {
bool a = address(this).call(address(this).delegatecall, super);
bool b = address(this).delegatecall(log0, tx, mulmod);
bool a = address(this).call(abi.encode(address(this).delegatecall, super));
bool b = address(this).delegatecall(abi.encode(log0, tx, mulmod));
a; b;
}
}
// ----
// TypeError: (80-106): This type cannot be encoded.
// TypeError: (108-113): This type cannot be encoded.
// TypeError: (160-164): This type cannot be encoded.
// TypeError: (166-168): This type cannot be encoded.
// TypeError: (170-176): This type cannot be encoded.
// TypeError: (91-117): This type cannot be encoded.
// TypeError: (119-124): This type cannot be encoded.
// TypeError: (183-187): This type cannot be encoded.
// TypeError: (189-191): This type cannot be encoded.
// TypeError: (193-199): This type cannot be encoded.
@@ -4,11 +4,10 @@ contract C {
struct T { uint y; }
T t;
function f() public view {
bytes32 a = sha256(s, t);
bytes32 a = sha256(abi.encodePacked(s, t));
a;
}
}
// ----
// Warning: (132-144): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (139-140): This type cannot be encoded.
// TypeError: (142-143): This type cannot be encoded.
// TypeError: (156-157): This type cannot be encoded.
// TypeError: (159-160): This type cannot be encoded.
@@ -6,12 +6,11 @@ contract C {
struct T { uint y; }
T t;
function f() public view {
bytes32 a = sha256(s, t);
bytes32 a = sha256(abi.encodePacked(s, t));
a;
}
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (167-179): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (174-175): This type cannot be encoded.
// TypeError: (177-178): This type cannot be encoded.
// TypeError: (191-192): This type cannot be encoded.
// TypeError: (194-195): This type cannot be encoded.
@@ -5,12 +5,13 @@ contract C {
T t;
enum A { X, Y }
function f() public pure {
bool a = address(this).delegatecall(S, A, A.X, T, uint, uint[]);
bytes memory a = abi.encodePacked(S, A, A.X, T, uint, uint[]);
a;
}
}
// ----
// TypeError: (176-177): This type cannot be encoded.
// TypeError: (179-180): This type cannot be encoded.
// TypeError: (187-188): This type cannot be encoded.
// TypeError: (190-194): This type cannot be encoded.
// TypeError: (196-202): This type cannot be encoded.
// TypeError: (174-175): This type cannot be encoded.
// TypeError: (177-178): This type cannot be encoded.
// TypeError: (185-186): This type cannot be encoded.
// TypeError: (188-192): This type cannot be encoded.
// TypeError: (194-200): This type cannot be encoded.
@@ -1,26 +1,8 @@
contract C {
function f() pure public returns (bytes32) {
return keccak256(1);
}
function h() pure public returns (bytes32) {
return sha256(1);
}
function j() pure public returns (bytes32) {
return ripemd160(1);
}
function k() pure public returns (bytes) {
return abi.encodePacked(1);
}
}
// ----
// Warning: (87-88): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (77-89): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (77-89): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// Warning: (168-169): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (161-170): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (161-170): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// Warning: (252-253): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (242-254): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (242-254): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// Warning: (341-342): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (92-93): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning.
@@ -1,34 +1,9 @@
pragma experimental "v0.5.0";
contract C {
function f() pure public returns (bytes32) {
return keccak256(1);
}
function g() pure public returns (bytes32) {
return sha3(1);
}
function h() pure public returns (bytes32) {
return sha256(1);
}
function j() pure public returns (bytes32) {
return ripemd160(1);
}
function k() pure public returns (bytes) {
return abi.encodePacked(1);
}
}
// ----
// TypeError: (117-118): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (107-119): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (107-119): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// TypeError: (191-198): "sha3" has been deprecated in favour of "keccak256"
// TypeError: (196-197): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (191-198): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (191-198): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// TypeError: (277-278): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (270-279): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (270-279): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// TypeError: (361-362): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (351-363): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// TypeError: (351-363): The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory.
// TypeError: (450-451): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
// TypeError: (122-123): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
@@ -1,13 +1,4 @@
contract C {
function f() pure public returns (bytes32) {
return keccak256(uint8(1));
}
function h() pure public returns (bytes32) {
return sha256(uint8(1));
}
function j() pure public returns (bytes32) {
return ripemd160(uint8(1));
}
function k() pure public returns (bytes) {
return abi.encodePacked(uint8(1));
}
@@ -16,9 +7,3 @@ contract C {
}
}
// ----
// Warning: (77-96): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (77-96): The provided argument of type uint8 is not implicitly convertible to expected type bytes memory.
// Warning: (168-184): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (168-184): The provided argument of type uint8 is not implicitly convertible to expected type bytes memory.
// Warning: (256-275): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data.
// Warning: (256-275): The provided argument of type uint8 is not implicitly convertible to expected type bytes memory.
@@ -3,13 +3,13 @@ contract C {
address(this).transfer(1);
require(address(this).send(2));
selfdestruct(address(this));
require(address(this).delegatecall());
require(address(this).call());
require(address(this).delegatecall(""));
require(address(this).call(""));
}
function g() pure public {
bytes32 x = keccak256("abc");
bytes32 y = sha256("abc");
address z = ecrecover(1, 2, 3, 4);
address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4));
require(true);
assert(true);
x; y; z;