mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Correct type conversions.
This commit is contained in:
parent
8cc70a12c6
commit
3d896c74e6
@ -835,6 +835,21 @@ BOOST_AUTO_TEST_CASE(function_types)
|
|||||||
BOOST_CHECK(callContractFunction("a(bool)", bytes{1}) == toBigEndian(u256(12)));
|
BOOST_CHECK(callContractFunction("a(bool)", bytes{1}) == toBigEndian(u256(12)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(type_conversions_cleanup)
|
||||||
|
{
|
||||||
|
// 22-byte integer converted to a contract (i.e. address, 20 bytes), converted to a 32 byte
|
||||||
|
// integer should drop the first two bytes
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract Test {
|
||||||
|
function test() returns (uint ret) { return uint(address(Test(address(0x11223344556677889900112233445566778899001122)))); }
|
||||||
|
})";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_REQUIRE(callContractFunction(0) == bytes({0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22,
|
||||||
|
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22}));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(send_ether)
|
BOOST_AUTO_TEST_CASE(send_ether)
|
||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user