aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityABIJSON.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-30 18:27:46 +0800
committerchriseth <c@ethdev.com>2016-12-01 23:03:59 +0800
commitf91ae3f06b8b6ae273a42020e81f882141a0a78f (patch)
tree9ec4bcb4e3ac28eb948cdbab3a92f2442e17df60 /test/libsolidity/SolidityABIJSON.cpp
parent35325ee7c3e1af558caf0a47c8611cdfde959bb3 (diff)
downloaddexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar.gz
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar.bz2
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar.lz
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar.xz
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.tar.zst
dexon-solidity-f91ae3f06b8b6ae273a42020e81f882141a0a78f.zip
Fix tests
Diffstat (limited to 'test/libsolidity/SolidityABIJSON.cpp')
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index f5f8b342..890db241 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -747,8 +747,11 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
bytes const& bytecode = m_compilerStack.runtimeObject("test").bytecode;
bytes hash = dev::swarmHash(m_compilerStack.onChainMetadata("test")).asBytes();
BOOST_REQUIRE(hash.size() == 32);
- BOOST_REQUIRE(bytecode.size() >= hash.size());
- BOOST_CHECK(std::equal(hash.begin(), hash.end(), bytecode.end() - 32));
+ BOOST_REQUIRE(bytecode.size() >= 2);
+ size_t metadataCBORSize = (size_t(bytecode.end()[-2]) << 8) + size_t(bytecode.end()[-1]);
+ BOOST_REQUIRE(metadataCBORSize < bytecode.size() - 2);
+ bytes expectation = bytes{0xa1, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} + hash;
+ BOOST_CHECK(std::equal(expectation.begin(), expectation.end(), bytecode.end() - metadataCBORSize - 2));
}
BOOST_AUTO_TEST_SUITE_END()