diff options
author | chriseth <chris@ethereum.org> | 2017-03-15 21:55:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 21:55:45 +0800 |
commit | 0c8a766146cf1416143a5b1a66050b8d6c233907 (patch) | |
tree | d8c307ff316496c26a7dbaf9f5a3a17d240dc030 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 6258fe71854824fb28edf49bbc244e079c9c4f78 (diff) | |
parent | 07d775294b0c3270ee9d7bd496837193919c3d94 (diff) | |
download | dexon-solidity-0c8a766146cf1416143a5b1a66050b8d6c233907.tar.gz dexon-solidity-0c8a766146cf1416143a5b1a66050b8d6c233907.tar.zst dexon-solidity-0c8a766146cf1416143a5b1a66050b8d6c233907.zip |
Merge pull request #1698 from ethereum/exp-notation
Fix scientific notation in number literals
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index a4fab721..7ef34383 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9233,6 +9233,39 @@ BOOST_AUTO_TEST_CASE(revert) BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42))); } +BOOST_AUTO_TEST_CASE(scientific_notation) +{ + char const* sourceCode = R"( + contract C { + function f() returns (uint) { + return 2e10 wei; + } + function g() returns (uint) { + return 200e-2 wei; + } + function h() returns (uint) { + return 2.5e1; + } + function i() returns (int) { + return -2e10; + } + function j() returns (int) { + return -200e-2; + } + function k() returns (int) { + return -2.5e1; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(20000000000))); + BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2))); + BOOST_CHECK(callContractFunction("h()") == encodeArgs(u256(25))); + BOOST_CHECK(callContractFunction("i()") == encodeArgs(u256(-20000000000))); + BOOST_CHECK(callContractFunction("j()") == encodeArgs(u256(-2))); + BOOST_CHECK(callContractFunction("k()") == encodeArgs(u256(-25))); +} + BOOST_AUTO_TEST_SUITE_END() } |