mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4684 from ethereum/underscores_in_numeric_literals
[BREAKING] Underscores in numeric literals
This commit is contained in:
@@ -12835,6 +12835,22 @@ BOOST_AUTO_TEST_CASE(write_storage_external)
|
||||
ABI_CHECK(callContractFunction("h()"), encodeArgs(12));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_underscore_in_hex)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function f(bool cond) public pure returns (uint) {
|
||||
uint32 x = 0x1234_ab;
|
||||
uint y = 0x1234_abcd_1234;
|
||||
return cond ? x : y;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
ABI_CHECK(callContractFunction("f(bool)", true), encodeArgs(u256(0x1234ab)));
|
||||
ABI_CHECK(callContractFunction("f(bool)", false), encodeArgs(u256(0x1234abcd1234)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user