aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-21 03:23:49 +0800
committerchriseth <c@ethdev.com>2017-01-25 00:41:31 +0800
commit8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e (patch)
tree842aebb47721e4991a7a9014904a60633a354c2b /test
parent3dc83aa34e83d668cde82953f9efa94ebb7de8ed (diff)
downloaddexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar.gz
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar.bz2
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar.lz
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar.xz
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.tar.zst
dexon-solidity-8e5f1c0d50c0512ac3e3c51ebec3afc500f4721e.zip
Test double inclusion of bytecode.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index e8e5ced1..646017fb 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -8992,6 +8992,35 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
compileAndRun(sourceCode, 0, "C2");
}
+BOOST_AUTO_TEST_CASE(include_creation_bytecode_only_once)
+{
+ char const* sourceCode = R"(
+ contract D {
+ bytes a = hex"1237651237125387136581271652831736512837126583171583712358126123765123712538713658127165283173651283712658317158371235812612376512371253871365812716528317365128371265831715837123581261237651237125387136581271652831736512837126583171583712358126";
+ bytes b = hex"1237651237125327136581271252831736512837126583171383712358126123765125712538713658127165253173651283712658357158371235812612376512371a5387136581271652a317365128371265a317158371235812612a765123712538a13658127165a83173651283712a58317158371235a126";
+ function D(uint) {}
+ }
+ contract Double {
+ function f() {
+ new D(2);
+ }
+ function g() {
+ new D(3);
+ }
+ }
+ contract Single {
+ function f() {
+ new D(2);
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK_LE(
+ double(m_compiler.object("Double").bytecode.size()),
+ 1.1 * double(m_compiler.object("Single").bytecode.size())
+ );
+}
+
BOOST_AUTO_TEST_CASE(recursive_structs)
{
char const* sourceCode = R"(