mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add a dynamic array push() test
This commit is contained in:
parent
e11e10f817
commit
763b544822
@ -3452,6 +3452,7 @@ BOOST_AUTO_TEST_CASE(array_copy_target_leftover2)
|
|||||||
asString(fromHex("0000000000000000"))
|
asString(fromHex("0000000000000000"))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct)
|
BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
@ -3476,6 +3477,22 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct)
|
|||||||
BOOST_CHECK(m_state.storage(m_contractAddress).empty());
|
BOOST_CHECK(m_state.storage(m_contractAddress).empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(array_push)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
int[] data;
|
||||||
|
function test() returns (uint) {
|
||||||
|
data.push(5);
|
||||||
|
data.push(4);
|
||||||
|
return data.push(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("test()") == encodeArgs(3));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(external_array_args)
|
BOOST_AUTO_TEST_CASE(external_array_args)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user