diff options
author | chriseth <c@ethdev.com> | 2015-10-02 17:11:43 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-02 17:11:43 +0800 |
commit | 0bedebe9b54e8c445476a5650cd7eacc3d060b02 (patch) | |
tree | 4860eb391362a98e8346ae5b80850970dfedbd59 /test | |
parent | 5f6c3cdf5414af457569041d1fdf6caa4cf9a82c (diff) | |
parent | 6161ec96ff4a449d6fffa3d1e54c3fa38911c2bb (diff) | |
download | dexon-solidity-0bedebe9b54e8c445476a5650cd7eacc3d060b02.tar.gz dexon-solidity-0bedebe9b54e8c445476a5650cd7eacc3d060b02.tar.zst dexon-solidity-0bedebe9b54e8c445476a5650cd7eacc3d060b02.zip |
Merge pull request #105 from chriseth/fix_calldataUnpacker
Bugfix in calldata unpacker.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/Assembly.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index b4678611..ca1e8980 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(location_test) AssemblyItems items = compileContract(sourceCode); vector<SourceLocation> locations = vector<SourceLocation>(17, SourceLocation(2, 75, n)) + - vector<SourceLocation>(26, SourceLocation(20, 72, n)) + + vector<SourceLocation>(28, SourceLocation(20, 72, n)) + vector<SourceLocation>{SourceLocation(42, 51, n), SourceLocation(65, 67, n)} + vector<SourceLocation>(4, SourceLocation(58, 67, n)) + vector<SourceLocation>(3, SourceLocation(20, 72, n)); diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 3124f9cf..0459c3ae 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5354,6 +5354,25 @@ BOOST_AUTO_TEST_CASE(fixed_arrays_as_return_type) ); } +BOOST_AUTO_TEST_CASE(calldata_offset) +{ + // This tests a specific bug that was caused by not using the correct memory offset in the + // calldata unpacker. + char const* sourceCode = R"( + contract CB + { + address[] _arr; + string public last = "nd"; + function CB(address[] guardians) + { + _arr = guardians; + } + } + )"; + compileAndRun(sourceCode, 0, "CB", encodeArgs(u256(0x20))); + BOOST_CHECK(callContractFunction("last()", encodeArgs()) == encodeDyn(string("nd"))); +} + BOOST_AUTO_TEST_SUITE_END() } |