mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add tests for fractional numbers in exponential notation
This commit is contained in:
parent
e923f27ea8
commit
b0a23fa77d
@ -9186,11 +9186,15 @@ BOOST_AUTO_TEST_CASE(scientific_notation)
|
|||||||
function g() returns (uint) {
|
function g() returns (uint) {
|
||||||
return 200e-2 wei;
|
return 200e-2 wei;
|
||||||
}
|
}
|
||||||
|
function h() returns (uint) {
|
||||||
|
return 2.5e1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
compileAndRun(sourceCode, 0, "C");
|
compileAndRun(sourceCode, 0, "C");
|
||||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(20000000000)));
|
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(20000000000)));
|
||||||
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2)));
|
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2)));
|
||||||
|
BOOST_CHECK(callContractFunction("h()") == encodeArgs(u256(25)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -1487,6 +1487,7 @@ BOOST_AUTO_TEST_CASE(scientific_notation)
|
|||||||
uint256 b = 2E10;
|
uint256 b = 2E10;
|
||||||
uint256 c = 200e-2;
|
uint256 c = 200e-2;
|
||||||
uint256 d = 2E10 wei;
|
uint256 d = 2E10 wei;
|
||||||
|
uint256 e = 2.5e10;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
|
Loading…
Reference in New Issue
Block a user