mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fixing some calldata to storage tests.
This commit is contained in:
parent
61069ec77d
commit
2b52677a82
@ -10,28 +10,28 @@ contract c {
|
||||
a1 = c;
|
||||
assert(a1[0][0] == c[0][0]);
|
||||
assert(a1[0][1] == c[0][1]);
|
||||
return (a1.length, a1[1][0] + a1[1][1]);
|
||||
return (a1.length, a1[0][0] + a1[1][1]);
|
||||
}
|
||||
|
||||
function test2(uint256[][2] calldata c) external returns (uint256, uint256) {
|
||||
a2 = c;
|
||||
assert(a2[0][0] == c[0][0]);
|
||||
assert(a2[0][1] == c[0][1]);
|
||||
return (a2[0].length, a2[1][0] + a2[1][1]);
|
||||
return (a2[0].length, a2[0][0] + a2[1][1]);
|
||||
}
|
||||
|
||||
function test3(uint256[2][] calldata c) external returns (uint256, uint256) {
|
||||
a3 = c;
|
||||
assert(a3[0][0] == c[0][0]);
|
||||
assert(a3[0][1] == c[0][1]);
|
||||
return (a3.length, a3[1][0] + a3[1][1]);
|
||||
return (a3.length, a3[0][0] + a3[1][1]);
|
||||
}
|
||||
|
||||
function test4(uint256[2][2] calldata c) external returns (uint256) {
|
||||
a4 = c;
|
||||
assert(a4[0][0] == c[0][0]);
|
||||
assert(a4[0][1] == c[0][1]);
|
||||
return (a4[1][0] + a4[1][1]);
|
||||
return (a4[0][0] + a4[1][1]);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
@ -39,5 +39,5 @@ contract c {
|
||||
// ----
|
||||
// test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
// test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
// test3(uint256[2][]): 0x20, 2, 0x40, 0x40, 23, 42 -> 2, 65
|
||||
// test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65
|
||||
// test4(uint256[2][2]): 23, 42, 23, 42 -> 65
|
||||
|
@ -9,6 +9,13 @@ contract C {
|
||||
|
||||
function f(S[] calldata c) external returns (uint256, uint256) {
|
||||
s = c;
|
||||
assert(s.length == c.length);
|
||||
for (uint i = 0; i < s.length; i++) {
|
||||
assert(s[i].a.length == c[i].a.length);
|
||||
for (uint j = 0; j < s[i].a.length; j++) {
|
||||
assert(s[i].a[j] == c[i].a[j]);
|
||||
}
|
||||
}
|
||||
return (s[1].a.length, s[1].a[0]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user