aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-10-15 20:37:11 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-10-15 20:37:11 +0800
commita823de2d5863efb45e6d0a9d11e41f511687b831 (patch)
tree0217e435e8ed9e0ea0a71de49b868ad85cb85e79 /test/libsolidity
parent9224c1f7128f92f47ddf3feaf83b57d6d98e0a04 (diff)
downloaddexon-solidity-a823de2d5863efb45e6d0a9d11e41f511687b831.tar.gz
dexon-solidity-a823de2d5863efb45e6d0a9d11e41f511687b831.tar.zst
dexon-solidity-a823de2d5863efb45e6d0a9d11e41f511687b831.zip
push() for byte arrays also properly implemented
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 96a426dd..c71c9a58 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -3495,26 +3495,27 @@ BOOST_AUTO_TEST_CASE(array_push)
compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("test()") == encodeArgs(5, 4, 3, 3));
}
-#if 0 // reactivate once ByteArrayPush is properly implemented
+
BOOST_AUTO_TEST_CASE(byte_array_push)
{
char const* sourceCode = R"(
contract c {
bytes data;
- function test() returns (byte x, byte y, byte z, uint l) {
- data.push(5);
- x = data[0];
+ function test() returns (bool x) {
+ if (data.push(5) != 1) return true;
+ if (data[0] != 5) return true;
data.push(4);
- y = data[1];
- l = data.push(3);
- z = data[2];
+ if (data[1] != 4) return true;
+ uint l = data.push(3);
+ if (data[2] != 3) return true;
+ if (l != 3) return true;
}
}
)";
compileAndRun(sourceCode);
- BOOST_CHECK(callContractFunction("test()") == encodeArgs(5, 4, 3, 3));
+ BOOST_CHECK(callContractFunction("test()") == encodeArgs(false));
}
-#endif
+
BOOST_AUTO_TEST_CASE(external_array_args)
{
char const* sourceCode = R"(