mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add stricter hex underscore rules
This commit is contained in:
committed by
Christian Parpart
parent
0000bfc604
commit
09a36cba02
@@ -12836,6 +12836,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) 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