Skip to content

Commit

Permalink
Update end to end tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Aug 7, 2018
1 parent 348f464 commit 57293f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions test/libsolidity/ABIDecoderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(byte_arrays)
return (a, b.length, b[3], c);
}
function f_external(uint a, bytes b, uint c)
function f_external(uint a, bytes calldata b, uint c)
external pure returns (uint, uint, byte, uint) {
return (a, b.length, b[3], c);
}
Expand All @@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(calldata_arrays_too_large)
{
string sourceCode = R"(
contract C {
function f(uint a, uint[] b, uint c) external pure returns (uint) {
function f(uint a, uint[] calldata b, uint c) external pure returns (uint) {
return 7;
}
}
Expand Down
24 changes: 12 additions & 12 deletions test/libsolidity/SolidityEndToEndTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4362,7 +4362,7 @@ BOOST_AUTO_TEST_CASE(struct_containing_bytes_copy_and_delete)
struct Struct { uint a; bytes data; uint b; }
Struct data1;
Struct data2;
function set(uint _a, bytes _data, uint _b) external returns (bool) {
function set(uint _a, bytes calldata _data, uint _b) external returns (bool) {
data1.a = _a;
data1.b = _b;
data1.data = _data;
Expand Down Expand Up @@ -4701,7 +4701,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_arguments)
uint result;
function f(uint a, uint b) public { result += a + b; }
function g(uint a) public { result *= a; }
function test(uint a, bytes data1, bytes data2, uint b) external returns (uint r_a, uint r, uint r_b, uint l) {
function test(uint a, bytes calldata data1, bytes calldata data2, uint b) external returns (uint r_a, uint r, uint r_b, uint l) {
r_a = a;
address(this).call(data1);
address(this).call(data2);
Expand Down Expand Up @@ -5636,7 +5636,7 @@ BOOST_AUTO_TEST_CASE(external_array_args)
{
char const* sourceCode = R"(
contract c {
function test(uint[8] a, uint[] b, uint[5] c, uint a_index, uint b_index, uint c_index)
function test(uint[8] calldata a, uint[] calldata b, uint[5] calldata c, uint a_index, uint b_index, uint c_index)
external returns (uint av, uint bv, uint cv) {
av = a[a_index];
bv = b[b_index];
Expand All @@ -5661,10 +5661,10 @@ BOOST_AUTO_TEST_CASE(bytes_index_access)
char const* sourceCode = R"(
contract c {
bytes data;
function direct(bytes arg, uint index) external returns (uint) {
function direct(bytes calldata arg, uint index) external returns (uint) {
return uint(uint8(arg[index]));
}
function storageCopyRead(bytes arg, uint index) external returns (uint) {
function storageCopyRead(bytes calldata arg, uint index) external returns (uint) {
data = arg;
return uint(uint8(data[index]));
}
Expand Down Expand Up @@ -5719,7 +5719,7 @@ BOOST_AUTO_TEST_CASE(array_copy_calldata_storage)
uint[9] m_data;
uint[] m_data_dyn;
uint8[][] m_byte_data;
function store(uint[9] a, uint8[3][] b) external returns (uint8) {
function store(uint[9] calldata a, uint8[3][] calldata b) external returns (uint8) {
m_data = a;
m_data_dyn = a;
m_byte_data = b;
Expand Down Expand Up @@ -5758,7 +5758,7 @@ BOOST_AUTO_TEST_CASE(array_copy_nested_array)
uint[4][] a;
uint[10][] b;
uint[][] c;
function test(uint[2][] d) external returns (uint) {
function test(uint[2][] calldata d) external returns (uint) {
a = d;
b = a;
c = b;
Expand Down Expand Up @@ -6709,7 +6709,7 @@ BOOST_AUTO_TEST_CASE(return_string)
char const* sourceCode = R"(
contract Main {
string public s;
function set(string _s) external {
function set(string calldata _s) external {
s = _s;
}
function get1() public returns (string memory r) {
Expand All @@ -6735,7 +6735,7 @@ BOOST_AUTO_TEST_CASE(return_multiple_strings_of_various_sizes)
contract Main {
string public s1;
string public s2;
function set(string _s1, uint x, string _s2) external returns (uint) {
function set(string calldata _s1, uint x, string calldata _s2) external returns (uint) {
s1 = _s1;
s2 = _s2;
return x;
Expand Down Expand Up @@ -6784,7 +6784,7 @@ BOOST_AUTO_TEST_CASE(accessor_involving_strings)
contract Main {
struct stringData { string a; uint b; string c; }
mapping(uint => stringData[]) public data;
function set(uint x, uint y, string a, uint b, string c) external returns (bool) {
function set(uint x, uint y, string calldata a, uint b, string c) external returns (bool) {
data[x].length = y + 1;
data[x][y].a = a;
data[x][y].b = b;
Expand Down Expand Up @@ -6821,7 +6821,7 @@ BOOST_AUTO_TEST_CASE(bytes_in_function_calls)
function setIndirectFromMemory(string memory _s1, uint x, string memory _s2) public returns (uint) {
return this.set(_s1, x, _s2);
}
function setIndirectFromCalldata(string _s1, uint x, string _s2) external returns (uint) {
function setIndirectFromCalldata(string calldata _s1, uint x, string calldata _s2) external returns (uint) {
return this.set(_s1, x, _s2);
}
}
Expand Down Expand Up @@ -6862,7 +6862,7 @@ BOOST_AUTO_TEST_CASE(return_bytes_internal)
s1 = _s1;
_r1 = s1;
}
function set(bytes _s1) external returns (uint _r, bytes memory _r1) {
function set(bytes calldata _s1) external returns (uint _r, bytes memory _r1) {
_r1 = doSet(_s1);
_r = _r1.length;
}
Expand Down

0 comments on commit 57293f7

Please sign in to comment.