aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-19 16:29:59 +0800
committerchriseth <c@ethdev.com>2015-06-19 16:29:59 +0800
commit2a870afc7b73de8df8fccf1f304c4be2e69bb7cb (patch)
treeabfaa5147d476810fca0b5d5adedf86fe6dce99e /libsolidity/SolidityEndToEndTest.cpp
parent93a6f63669465ed277335cb346948fb50814e67f (diff)
parent6d2f2f668ba2529aa2ed0bae88afc55b2869cd97 (diff)
downloaddexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar.gz
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar.bz2
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar.lz
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar.xz
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.tar.zst
dexon-solidity-2a870afc7b73de8df8fccf1f304c4be2e69bb7cb.zip
Merge pull request #2232 from chriseth/sol_externalConstructorTests
Tests for constructor arguments "from outside".
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--libsolidity/SolidityEndToEndTest.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp
index 95f253d5..a839aa02 100644
--- a/libsolidity/SolidityEndToEndTest.cpp
+++ b/libsolidity/SolidityEndToEndTest.cpp
@@ -1726,7 +1726,7 @@ BOOST_AUTO_TEST_CASE(fixed_bytes_in_calls)
BOOST_CHECK(callContractFunction("callHelper(bytes2,bool)", string("\0a", 2), true) == encodeArgs(string("\0a\0\0\0", 5)));
}
-BOOST_AUTO_TEST_CASE(constructor_arguments)
+BOOST_AUTO_TEST_CASE(constructor_arguments_internal)
{
char const* sourceCode = R"(
contract Helper {
@@ -1749,8 +1749,28 @@ BOOST_AUTO_TEST_CASE(constructor_arguments)
function getName() returns (bytes3 ret) { return h.getName(); }
})";
compileAndRun(sourceCode, 0, "Main");
- BOOST_REQUIRE(callContractFunction("getFlag()") == encodeArgs(true));
- BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc"));
+ BOOST_CHECK(callContractFunction("getFlag()") == encodeArgs(true));
+ BOOST_CHECK(callContractFunction("getName()") == encodeArgs("abc"));
+}
+
+BOOST_AUTO_TEST_CASE(constructor_arguments_external)
+{
+ char const* sourceCode = R"(
+ contract Main {
+ bytes3 name;
+ bool flag;
+
+ function Main(bytes3 x, bool f) {
+ name = x;
+ flag = f;
+ }
+ function getName() returns (bytes3 ret) { return name; }
+ function getFlag() returns (bool ret) { return flag; }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "Main", encodeArgs("abc", true));
+ BOOST_CHECK(callContractFunction("getFlag()") == encodeArgs(true));
+ BOOST_CHECK(callContractFunction("getName()") == encodeArgs("abc"));
}
BOOST_AUTO_TEST_CASE(functions_called_by_constructor)
@@ -4166,7 +4186,7 @@ BOOST_AUTO_TEST_CASE(evm_exceptions_in_constructor_out_of_baund)
}
}
)";
- BOOST_CHECK(compileAndRunWthoutCheck(sourceCode, 0, "A").empty());
+ BOOST_CHECK(compileAndRunWithoutCheck(sourceCode, 0, "A").empty());
}
BOOST_AUTO_TEST_CASE(positive_integers_to_signed)