mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test for allocation bug.
This commit is contained in:
parent
2554d6104a
commit
588e4232eb
@ -5849,6 +5849,37 @@ BOOST_AUTO_TEST_CASE(addmod_mulmod)
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("test()") == encodeArgs(u256(0)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(string_allocation_bug)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Sample
|
||||
{
|
||||
struct s { uint16 x; uint16 y; string a; string b;}
|
||||
s[2] public p;
|
||||
function Sample() {
|
||||
s memory m;
|
||||
m.x = 0xbbbb;
|
||||
m.y = 0xcccc;
|
||||
m.a = "hello";
|
||||
m.b = "world";
|
||||
p[0] = m;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("p(uint256)") == encodeArgs(
|
||||
u256(0xbbbb),
|
||||
u256(0xcccc),
|
||||
u256(0x80),
|
||||
u256(0xc0),
|
||||
u256(5),
|
||||
string("hello"),
|
||||
u256(5),
|
||||
string("world")
|
||||
));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user