aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-09 03:36:57 +0800
committerGitHub <noreply@github.com>2018-08-09 03:36:57 +0800
commitd634d20b5b0dac3e5caf1741073fa123fdd56ab9 (patch)
treee88008bc8a8e665d32d8ac8c9125595dd90e8a22 /test/libsolidity/SolidityEndToEndTest.cpp
parent551343ae3eb1b3f1575d91a4f7021c0f9529d5bd (diff)
parentb9222808f61e00833f8c11cd196cafb50ec9e1b9 (diff)
downloaddexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.tar.gz
dexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.tar.zst
dexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.zip
Merge pull request #4684 from ethereum/underscores_in_numeric_literals
[BREAKING] Underscores in numeric literals
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 9f7602d1..e487f0ae 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -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()
}