From b0a23fa77d4e5f16b3ab1a56000db45748a05838 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 15 Mar 2017 12:21:58 +0000 Subject: Add tests for fractional numbers in exponential notation --- test/libsolidity/SolidityEndToEndTest.cpp | 4 ++++ test/libsolidity/SolidityParser.cpp | 1 + 2 files changed, 5 insertions(+) (limited to 'test/libsolidity') diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 21d9074d..ebc9f51e 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9186,11 +9186,15 @@ BOOST_AUTO_TEST_CASE(scientific_notation) function g() returns (uint) { return 200e-2 wei; } + function h() returns (uint) { + 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_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index cfc76ae0..ffb4b6f2 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -1487,6 +1487,7 @@ BOOST_AUTO_TEST_CASE(scientific_notation) uint256 b = 2E10; uint256 c = 200e-2; uint256 d = 2E10 wei; + uint256 e = 2.5e10; } )"; BOOST_CHECK(successParse(text)); -- cgit