aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-10-12 15:57:18 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-10-15 16:52:30 +0800
commit763b544822778110eb23106060ffae5f3d0b6e95 (patch)
tree21966d26e0b754305f3743488d83214f65a6b660 /test/libsolidity
parente11e10f8176cd6f866e78b5d12c86fe77367c64a (diff)
downloaddexon-solidity-763b544822778110eb23106060ffae5f3d0b6e95.tar.gz
dexon-solidity-763b544822778110eb23106060ffae5f3d0b6e95.tar.zst
dexon-solidity-763b544822778110eb23106060ffae5f3d0b6e95.zip
Add a dynamic array push() test
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 08f62963..b78ea8ec 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -3452,6 +3452,7 @@ BOOST_AUTO_TEST_CASE(array_copy_target_leftover2)
asString(fromHex("0000000000000000"))
));
}
+
BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct)
{
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_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)
{
char const* sourceCode = R"(