mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests
This commit is contained in:
parent
35908c602b
commit
1fa371d426
@ -8,6 +8,8 @@ contract C {
|
||||
return b + c;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> 58626
|
||||
// f(uint16,uint16,uint16): 0x1000, 0xe500, 0xe000 -> FAILURE, hex"4e487b71", 0x11
|
||||
|
@ -0,0 +1,22 @@
|
||||
contract A { constructor(uint) {} }
|
||||
contract B { constructor(uint) {} }
|
||||
contract C { constructor(uint) {} }
|
||||
|
||||
contract D is A, B, C {
|
||||
uint[] x;
|
||||
constructor() m2(f(1)) B(f(2)) m1(f(3)) C(f(4)) m3(f(5)) A(f(6)) {
|
||||
f(7);
|
||||
}
|
||||
|
||||
function query() public view returns (uint[] memory) { return x; }
|
||||
|
||||
modifier m1(uint) { _; }
|
||||
modifier m2(uint) { _; }
|
||||
modifier m3(uint) { _; }
|
||||
|
||||
function f(uint y) internal returns (uint) { x.push(y); return 0; }
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// query() -> 0x20, 7, 4, 2, 6, 1, 3, 5, 7
|
@ -14,6 +14,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(bool): true -> 0
|
||||
// f(bool): false -> 3
|
||||
|
@ -8,6 +8,7 @@ contract C {
|
||||
r += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: false
|
||||
// ----
|
||||
// f() -> 10
|
||||
|
@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
modifier repeat(uint256 count) {
|
||||
uint256 i;
|
||||
for (i = 0; i < count; ++i) _;
|
||||
}
|
||||
|
||||
function f() public repeat(10) returns (uint256 r) {
|
||||
r += 1;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 1
|
@ -8,7 +8,8 @@ contract C {
|
||||
r += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: false
|
||||
// ----
|
||||
// f(bool): false -> 1
|
||||
// f(bool): true -> 2
|
||||
|
@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
modifier repeat(bool twice) {
|
||||
if (twice) _;
|
||||
_;
|
||||
}
|
||||
|
||||
function f(bool twice) public repeat(twice) returns (uint256 r) {
|
||||
r += 1;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f(bool): false -> 1
|
||||
// f(bool): true -> 1
|
@ -11,7 +11,8 @@ contract C {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: false
|
||||
// ----
|
||||
// f(bool): false -> 1
|
||||
// f(bool): true -> 2
|
||||
|
@ -10,6 +10,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256): 3 -> 10
|
||||
// a() -> 10
|
||||
|
@ -13,6 +13,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256): 3 -> 10
|
||||
// a() -> 0
|
||||
|
@ -8,6 +8,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256): 9 -> 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
// f(uint256): 10 -> 0x00, 0x00, 3, 0x00, 0x00
|
||||
|
@ -15,6 +15,8 @@ contract C {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// x() -> 0
|
||||
// f() -> 42
|
||||
|
Loading…
Reference in New Issue
Block a user