mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update existing tests.
This commit is contained in:
parent
33d8b62d06
commit
e61fa59593
@ -33,7 +33,7 @@ object "Arraysum_33" {
|
||||
for { }
|
||||
lt(vloc_i, _2)
|
||||
{
|
||||
if gt(vloc_i, not(1)) { invalid() }
|
||||
if eq(vloc_i, not(0)) { invalid() }
|
||||
vloc_i := add(vloc_i, 1)
|
||||
}
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(function_calls)
|
||||
uint data2;
|
||||
function f(uint x) public {
|
||||
if (x > 7)
|
||||
data2 = g(x**8) + 1;
|
||||
{ unchecked { data2 = g(x**8) + 1; } }
|
||||
else
|
||||
data = 1;
|
||||
}
|
||||
@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(multiple_external_functions)
|
||||
uint data2;
|
||||
function f(uint x) public {
|
||||
if (x > 7)
|
||||
data2 = g(x**8) + 1;
|
||||
{ unchecked { data2 = g(x**8) + 1; } }
|
||||
else
|
||||
data = 1;
|
||||
}
|
||||
@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(exponent_size)
|
||||
char const* sourceCode = R"(
|
||||
contract A {
|
||||
function f(uint x) public returns (uint) {
|
||||
return x ** 0;
|
||||
unchecked { return x ** 0; }
|
||||
}
|
||||
function g(uint x) public returns (uint) {
|
||||
return x ** 0x100;
|
||||
unchecked { return x ** 0x100; }
|
||||
}
|
||||
function h(uint x) public returns (uint) {
|
||||
return x ** 0x10000;
|
||||
unchecked { return x ** 0x10000; }
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -289,29 +289,31 @@ BOOST_AUTO_TEST_CASE(complex_control_flow)
|
||||
char const* sourceCode = R"(
|
||||
contract log {
|
||||
function ln(int128 x) public pure returns (int128 result) {
|
||||
int128 t = x / 256;
|
||||
int128 y = 5545177;
|
||||
x = t;
|
||||
t = x * 16; if (t <= 1000000) { x = t; y = y - 2772588; }
|
||||
t = x * 4; if (t <= 1000000) { x = t; y = y - 1386294; }
|
||||
t = x * 2; if (t <= 1000000) { x = t; y = y - 693147; }
|
||||
t = x + x / 2; if (t <= 1000000) { x = t; y = y - 405465; }
|
||||
t = x + x / 4; if (t <= 1000000) { x = t; y = y - 223144; }
|
||||
t = x + x / 8; if (t <= 1000000) { x = t; y = y - 117783; }
|
||||
t = x + x / 16; if (t <= 1000000) { x = t; y = y - 60624; }
|
||||
t = x + x / 32; if (t <= 1000000) { x = t; y = y - 30771; }
|
||||
t = x + x / 64; if (t <= 1000000) { x = t; y = y - 15504; }
|
||||
t = x + x / 128; if (t <= 1000000) { x = t; y = y - 7782; }
|
||||
t = x + x / 256; if (t <= 1000000) { x = t; y = y - 3898; }
|
||||
t = x + x / 512; if (t <= 1000000) { x = t; y = y - 1951; }
|
||||
t = x + x / 1024; if (t <= 1000000) { x = t; y = y - 976; }
|
||||
t = x + x / 2048; if (t <= 1000000) { x = t; y = y - 488; }
|
||||
t = x + x / 4096; if (t <= 1000000) { x = t; y = y - 244; }
|
||||
t = x + x / 8192; if (t <= 1000000) { x = t; y = y - 122; }
|
||||
t = x + x / 16384; if (t <= 1000000) { x = t; y = y - 61; }
|
||||
t = x + x / 32768; if (t <= 1000000) { x = t; y = y - 31; }
|
||||
t = x + x / 65536; if (t <= 1000000) { y = y - 15; }
|
||||
return y;
|
||||
unchecked {
|
||||
int128 t = x / 256;
|
||||
int128 y = 5545177;
|
||||
x = t;
|
||||
t = x * 16; if (t <= 1000000) { x = t; y = y - 2772588; }
|
||||
t = x * 4; if (t <= 1000000) { x = t; y = y - 1386294; }
|
||||
t = x * 2; if (t <= 1000000) { x = t; y = y - 693147; }
|
||||
t = x + x / 2; if (t <= 1000000) { x = t; y = y - 405465; }
|
||||
t = x + x / 4; if (t <= 1000000) { x = t; y = y - 223144; }
|
||||
t = x + x / 8; if (t <= 1000000) { x = t; y = y - 117783; }
|
||||
t = x + x / 16; if (t <= 1000000) { x = t; y = y - 60624; }
|
||||
t = x + x / 32; if (t <= 1000000) { x = t; y = y - 30771; }
|
||||
t = x + x / 64; if (t <= 1000000) { x = t; y = y - 15504; }
|
||||
t = x + x / 128; if (t <= 1000000) { x = t; y = y - 7782; }
|
||||
t = x + x / 256; if (t <= 1000000) { x = t; y = y - 3898; }
|
||||
t = x + x / 512; if (t <= 1000000) { x = t; y = y - 1951; }
|
||||
t = x + x / 1024; if (t <= 1000000) { x = t; y = y - 976; }
|
||||
t = x + x / 2048; if (t <= 1000000) { x = t; y = y - 488; }
|
||||
t = x + x / 4096; if (t <= 1000000) { x = t; y = y - 244; }
|
||||
t = x + x / 8192; if (t <= 1000000) { x = t; y = y - 122; }
|
||||
t = x + x / 16384; if (t <= 1000000) { x = t; y = y - 61; }
|
||||
t = x + x / 32768; if (t <= 1000000) { x = t; y = y - 31; }
|
||||
t = x + x / 65536; if (t <= 1000000) { y = y - 15; }
|
||||
return y;
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(does_not_include_creation_time_only_internal_functions)
|
||||
contract C {
|
||||
uint x;
|
||||
constructor() { f(); }
|
||||
function f() internal { for (uint i = 0; i < 10; ++i) x += 3 + i; }
|
||||
function f() internal { unchecked { for (uint i = 0; i < 10; ++i) x += 3 + i; } }
|
||||
}
|
||||
)";
|
||||
compiler().setOptimiserSettings(solidity::test::CommonOptions::get().optimize);
|
||||
|
@ -757,10 +757,12 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning)
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function run() public returns(uint256 y) {
|
||||
uint32 t = uint32(0xffffffff);
|
||||
uint32 x = t + 10;
|
||||
if (x >= 0xffffffff) return 0;
|
||||
return x;
|
||||
unchecked {
|
||||
uint32 t = uint32(0xffffffff);
|
||||
uint32 x = t + 10;
|
||||
if (x >= 0xffffffff) return 0;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -781,9 +783,11 @@ BOOST_AUTO_TEST_CASE(sign_extension)
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function run() public returns(uint256 y) {
|
||||
int64 x = -int32(0xff);
|
||||
if (x >= 0xff) return 0;
|
||||
return 0 - uint256(x);
|
||||
unchecked {
|
||||
int64 x = -int32(0xff);
|
||||
if (x >= 0xff) return 0;
|
||||
return 0 - uint256(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -803,9 +807,11 @@ BOOST_AUTO_TEST_CASE(small_unsigned_types)
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function run() public returns(uint256 y) {
|
||||
uint32 t = uint32(0xffffff);
|
||||
uint32 x = t * 0xffffff;
|
||||
return x / 0x100;
|
||||
unchecked {
|
||||
uint32 t = uint32(0xffffff);
|
||||
uint32 x = t * 0xffffff;
|
||||
return x / 0x100;
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -1804,8 +1810,11 @@ BOOST_AUTO_TEST_CASE(blockhash)
|
||||
function g() public returns (bool) { counter++; return true; }
|
||||
function f() public returns (bytes32[] memory r) {
|
||||
r = new bytes32[](259);
|
||||
for (uint i = 0; i < 259; i++)
|
||||
r[i] = blockhash(block.number - 257 + i);
|
||||
for (uint i = 0; i < 259; i++) {
|
||||
unchecked {
|
||||
r[i] = blockhash(block.number - 257 + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
@ -6881,7 +6890,7 @@ BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser)
|
||||
}
|
||||
uint x = 0x0000000000001234123412431234123412412342112341234124312341234124;
|
||||
// This is just to create many instances of x
|
||||
emit X(x + f() * g(tx.origin) ^ h(block.number));
|
||||
unchecked { emit X(x + f() * g(tx.origin) ^ h(block.number)); }
|
||||
assembly {
|
||||
// make scratch space dirty
|
||||
mstore(0, 0x4242424242424242424242424242424242424242424242424242424242424242)
|
||||
@ -6892,10 +6901,10 @@ BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser)
|
||||
return 0x0000000000001234123412431234123412412342112341234124312341234124;
|
||||
}
|
||||
function g(address a) internal pure returns (uint) {
|
||||
return uint(a) * 0x0000000000001234123412431234123412412342112341234124312341234124;
|
||||
unchecked { return uint(a) * 0x0000000000001234123412431234123412412342112341234124312341234124; }
|
||||
}
|
||||
function h(uint a) internal pure returns (uint) {
|
||||
return a * 0x0000000000001234123412431234123412412342112341234124312341234124;
|
||||
unchecked { return a * 0x0000000000001234123412431234123412412342112341234124312341234124; }
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE(arithmetic)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint y) { ((((((((y ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); }
|
||||
function f(uint y) { unchecked { ((((((((y ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); } }
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
|
||||
@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(unary_operators)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(int y) { !(~- y == 2); }
|
||||
function f(int y) { unchecked { !(~- y == 2); } }
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
|
||||
@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(unary_inc_dec)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint a) public returns (uint x) { x = --a ^ (a-- ^ (++a ^ a++)); }
|
||||
function f(uint a) public returns (uint x) { unchecked { x = --a ^ (a-- ^ (++a ^ a++)); } }
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}});
|
||||
@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE(assignment)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(uint a, uint b) { (a += b) * 2; }
|
||||
function f(uint a, uint b) { unchecked { (a += b) * 2; } }
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}});
|
||||
|
@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(function_calls)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f1(uint x) public returns (uint) { return x*x; }
|
||||
function f(uint x) public returns (uint) { return f1(7+x) - this.f1(x**9); }
|
||||
function f1(uint x) public returns (uint) { unchecked { return x*x; } }
|
||||
function f(uint x) public returns (uint) { unchecked { return f1(7+x) - this.f1(x**9); } }
|
||||
}
|
||||
)";
|
||||
compileBothVersions(sourceCode);
|
||||
|
@ -120,8 +120,9 @@ BOOST_AUTO_TEST_CASE(reserved_keywords)
|
||||
{
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Identifier));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::After));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Unchecked));
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Unchecked));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Var));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Reference));
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Illegal));
|
||||
}
|
||||
|
||||
@ -515,7 +516,6 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
"switch",
|
||||
"typedef",
|
||||
"typeof",
|
||||
"unchecked",
|
||||
"var"
|
||||
};
|
||||
|
||||
|
@ -2,16 +2,16 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function exp_neg_one(uint exponent) public returns(int) {
|
||||
return (-1)**exponent;
|
||||
unchecked { return (-1)**exponent; }
|
||||
}
|
||||
function exp_two(uint exponent) public returns(uint) {
|
||||
return 2**exponent;
|
||||
unchecked { return 2**exponent; }
|
||||
}
|
||||
function exp_zero(uint exponent) public returns(uint) {
|
||||
return 0**exponent;
|
||||
unchecked { return 0**exponent; }
|
||||
}
|
||||
function exp_one(uint exponent) public returns(uint) {
|
||||
return 1**exponent;
|
||||
unchecked { return 1**exponent; }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
|
@ -2,16 +2,16 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function exp_neg_one(uint exponent) public returns(int) {
|
||||
return (-1)**exponent;
|
||||
unchecked { return (-1)**exponent; }
|
||||
}
|
||||
function exp_two(uint exponent) public returns(uint) {
|
||||
return 2**exponent;
|
||||
unchecked { return 2**exponent; }
|
||||
}
|
||||
function exp_zero(uint exponent) public returns(uint) {
|
||||
return 0**exponent;
|
||||
unchecked { return 0**exponent; }
|
||||
}
|
||||
function exp_one(uint exponent) public returns(uint) {
|
||||
return 1**exponent;
|
||||
unchecked { return 1**exponent; }
|
||||
}
|
||||
}
|
||||
// ====
|
||||
|
@ -1,7 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure returns (uint x) {
|
||||
uint8 y = uint8(2)**uint8(8);
|
||||
return 0**y;
|
||||
unchecked {
|
||||
uint8 y = uint8(2)**uint8(8);
|
||||
return 0**y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure returns (uint8 x) {
|
||||
return uint8(0)**uint8(uint8(2)**uint8(8));
|
||||
unchecked {
|
||||
return uint8(0)**uint8(uint8(2)**uint8(8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure returns (uint8 x) {
|
||||
return uint8(0x166)**uint8(uint8(2)**uint8(8));
|
||||
unchecked {
|
||||
return uint8(0x166)**uint8(uint8(2)**uint8(8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,9 @@ contract C {
|
||||
// right before the exp
|
||||
uint16 e = 0x100;
|
||||
uint8 b = 0x2;
|
||||
return b**e;
|
||||
unchecked {
|
||||
return b**e;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
|
@ -1,8 +1,10 @@
|
||||
contract test {
|
||||
function f(uint x) public pure returns (uint, int) {
|
||||
uint a = 2 ** x;
|
||||
int b = -2 ** x;
|
||||
return (a, b);
|
||||
unchecked {
|
||||
uint a = 2 ** x;
|
||||
int b = -2 ** x;
|
||||
return (a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
|
@ -1,12 +1,13 @@
|
||||
contract test {
|
||||
function f() public pure returns (uint) {
|
||||
function f() public pure returns (uint r) {
|
||||
uint32 x;
|
||||
uint8 y;
|
||||
assembly {
|
||||
x := 0xfffffffffe
|
||||
y := 0x102
|
||||
}
|
||||
return x**y;
|
||||
unchecked { r = x**y; }
|
||||
return r;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
|
@ -1,6 +1,6 @@
|
||||
==== Source: s1.sol ====
|
||||
import {f as g, g as h} from "s2.sol";
|
||||
function f() pure returns (uint) { return h() - g(); }
|
||||
function f() pure returns (uint) { return 1000 + g() - h(); }
|
||||
==== Source: s2.sol ====
|
||||
import {f as h} from "s1.sol";
|
||||
function f() pure returns (uint) { return 2; }
|
||||
@ -10,5 +10,7 @@ contract C {
|
||||
return h() - f() - g();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// foo() -> -4
|
||||
// foo() -> 992
|
||||
|
@ -1,6 +1,6 @@
|
||||
==== Source: s1.sol ====
|
||||
import {f as g, g as h} from "s2.sol";
|
||||
function f() pure returns (uint) { return h() - g(); }
|
||||
function f() pure returns (uint) { return 100 + h() - g(); }
|
||||
==== Source: s2.sol ====
|
||||
import {f as h} from "s1.sol";
|
||||
function f() pure returns (uint) { return 2; }
|
||||
@ -12,5 +12,7 @@ contract C {
|
||||
return f() - g() - h();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// foo() -> -4
|
||||
// foo() -> 0x60
|
||||
|
@ -1,6 +1,6 @@
|
||||
==== Source: s1.sol ====
|
||||
import {f as g, g as h} from "s2.sol";
|
||||
function f() pure returns (uint) { return h() - g(); }
|
||||
function f() pure returns (uint) { return 1000 + h() - g(); }
|
||||
==== Source: s2.sol ====
|
||||
import {f as h} from "s1.sol";
|
||||
function f() pure returns (uint) { return 2; }
|
||||
@ -9,8 +9,10 @@ function g() pure returns (uint) { return 4; }
|
||||
import "s2.sol";
|
||||
contract C {
|
||||
function foo() public pure returns (uint) {
|
||||
return f() - g() - h();
|
||||
return 10000 + f() - g() - h();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// foo() -> -4
|
||||
// foo() -> 0x2324
|
||||
|
@ -1,11 +1,15 @@
|
||||
contract C {
|
||||
function f() public returns (uint16 x) {
|
||||
x = 0xffff;
|
||||
x += 32;
|
||||
x <<= 8;
|
||||
x >>= 16;
|
||||
unchecked {
|
||||
x = 0xffff;
|
||||
x += 32;
|
||||
x <<= 8;
|
||||
x >>= 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x0
|
||||
|
@ -13,7 +13,7 @@ contract C {
|
||||
return (2, 3);
|
||||
}
|
||||
function h(uint x, uint y) public pure returns (uint) {
|
||||
return x - y;
|
||||
unchecked { return x - y; }
|
||||
}
|
||||
function i(bool b) public pure returns (bool) {
|
||||
return !b;
|
||||
@ -28,6 +28,8 @@ contract C {
|
||||
return a * 7;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// d() ->
|
||||
// e(), 1 wei -> 1
|
||||
|
@ -4,10 +4,10 @@ contract C {
|
||||
uint16 b;
|
||||
|
||||
function f() public returns (uint256, uint256, uint256, uint256) {
|
||||
a++;
|
||||
unchecked { a++; }
|
||||
uint256 c = b;
|
||||
delete b;
|
||||
a -= 2;
|
||||
unchecked { a -= 2; }
|
||||
return (x, c, b, a);
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,10 @@ contract C {
|
||||
returns (uint256 x1, uint256 x2, uint256 x3, uint256 x4)
|
||||
{
|
||||
a = -2;
|
||||
b = (0 - uint8(a)) * 2;
|
||||
c = a * int8(120) * int8(121);
|
||||
unchecked {
|
||||
b = (0 - uint8(a)) * 2;
|
||||
c = a * int8(120) * int8(121);
|
||||
}
|
||||
x1 = uint256(a);
|
||||
x2 = b;
|
||||
x3 = uint256(c);
|
||||
@ -18,5 +20,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> -2, 4, -112, 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
contract test {
|
||||
function f() public returns (bool) {
|
||||
int256 x = -2**255;
|
||||
assert(-x == x);
|
||||
unchecked { assert(-x == x); }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,uint256): 5, 6 -> 11
|
||||
// f(uint256,uint256): -2, 1 -> -1
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256,int256): 5, 6 -> 11
|
||||
// f(int256,int256): -2, 1 -> -1
|
||||
|
@ -10,7 +10,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,uint256): 10, 3 -> 3
|
||||
// f(uint256,uint256): 1, 0 -> FAILURE
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,uint256): 10, 3 -> 1
|
||||
// f(uint256,uint256): 10, 2 -> 0
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256,int256): 10, 3 -> 1
|
||||
// f(int256,int256): 10, 2 -> 0
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,uint256): 5, 6 -> 30
|
||||
// f(uint256,uint256): -1, 1 -> -1
|
||||
|
@ -7,51 +7,42 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256,int256): 5, 6 -> 30
|
||||
// f(int256,int256): -1, 1 -> -1
|
||||
// f(int256,int256): -1, 2 -> -2
|
||||
// # positive, positive #
|
||||
// f(int256,int256): -1, 2 -> -2 # positive, positive #
|
||||
// f(int256,int256): 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, 2 -> FAILURE
|
||||
// f(int256,int256): 2, 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
// f(int256,int256): 2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> FAILURE
|
||||
// # positive, negative #
|
||||
// f(int256,int256): 2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> FAILURE # positive, negative #
|
||||
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, -2 -> 0x8000000000000000000000000000000000000000000000000000000000000000
|
||||
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000001, -2 -> FAILURE
|
||||
// f(int256,int256): 2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000
|
||||
// f(int256,int256): 2, 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> FAILURE
|
||||
// # negative, positive #
|
||||
// f(int256,int256): 2, 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> FAILURE # negative, positive #
|
||||
// f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000
|
||||
// f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000001 -> FAILURE
|
||||
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, 2 -> 0x8000000000000000000000000000000000000000000000000000000000000000
|
||||
// f(int256,int256): 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> FAILURE
|
||||
// # negative, negative #
|
||||
// f(int256,int256): 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> FAILURE # negative, negative #
|
||||
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000001, -2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, -2 -> FAILURE
|
||||
// f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000001 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
// f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> FAILURE
|
||||
// # small type #
|
||||
// f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> FAILURE # small type #
|
||||
// g(int8,int8): 5, 6 -> 30
|
||||
// g(int8,int8): -1, 1 -> -1
|
||||
// g(int8,int8): -1, 2 -> -2
|
||||
// # positive, positive #
|
||||
// g(int8,int8): -1, 2 -> -2 # positive, positive #
|
||||
// g(int8,int8): 63, 2 -> 126
|
||||
// g(int8,int8): 64, 2 -> FAILURE
|
||||
// g(int8,int8): 2, 63 -> 126
|
||||
// g(int8,int8): 2, 64 -> FAILURE
|
||||
// # positive, negative #
|
||||
// g(int8,int8): 2, 64 -> FAILURE # positive, negative #
|
||||
// g(int8,int8): 64, -2 -> -128
|
||||
// g(int8,int8): 65, -2 -> FAILURE
|
||||
// g(int8,int8): 2, -64 -> -128
|
||||
// g(int8,int8): 2, -65 -> FAILURE
|
||||
// # negative, positive #
|
||||
// g(int8,int8): 2, -65 -> FAILURE # negative, positive #
|
||||
// g(int8,int8): -2, 64 -> -128
|
||||
// g(int8,int8): -2, 65 -> FAILURE
|
||||
// g(int8,int8): -64, 2 -> -128
|
||||
// g(int8,int8): -65, 2 -> FAILURE
|
||||
// # negative, negative #
|
||||
// g(int8,int8): -65, 2 -> FAILURE # negative, negative #
|
||||
// g(int8,int8): -63, -2 -> 126
|
||||
// g(int8,int8): -64, -2 -> FAILURE
|
||||
// g(int8,int8): -2, -63 -> 126
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,uint256): 6, 5 -> 1
|
||||
// f(uint256,uint256): 6, 6 -> 0
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256,int256): 5, 6 -> -1
|
||||
// f(int256,int256): -2, 1 -> -3
|
||||
|
@ -101,4 +101,4 @@ contract ERC20 {
|
||||
// decreaseAllowance(address,uint256): 2, 0 -> true
|
||||
// decreaseAllowance(address,uint256): 2, 1 -> FAILURE
|
||||
// transfer(address,uint256): 2, 14 -> true
|
||||
// transfer(address,uint256): 2, 2 -> FAILURE
|
||||
// transfer(address,uint256): 2, 2 -> FAILURE
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int8,uint256): 2, 6 -> 64
|
||||
// f(int8,uint256): 2, 7 -> FAILURE
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint8,uint8): 2, 7 -> 0x80
|
||||
// f(uint8,uint8): 2, 8 -> FAILURE
|
||||
|
Loading…
Reference in New Issue
Block a user