aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-17 00:30:18 +0800
committerchriseth <c@ethdev.com>2015-03-17 00:30:18 +0800
commite26f2dcaaecfe2b99c3b19db323a82c5e83e0aed (patch)
tree3d8223a6b7f42c3ab46fdebc2079920ea7d59d00 /SolidityEndToEndTest.cpp
parent1d2e579effe06ef11f0eb3f368f50547129819d2 (diff)
parent67a9ec3bdb16c43477551ba6025f57adc5718d14 (diff)
downloaddexon-solidity-e26f2dcaaecfe2b99c3b19db323a82c5e83e0aed.tar.gz
dexon-solidity-e26f2dcaaecfe2b99c3b19db323a82c5e83e0aed.tar.zst
dexon-solidity-e26f2dcaaecfe2b99c3b19db323a82c5e83e0aed.zip
Merge pull request #1325 from LefterisJP/sol_MsgSig
Adding msg.sig Solidity Magic type
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r--SolidityEndToEndTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index a212286c..8ccf9b3f 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -1031,6 +1031,35 @@ BOOST_AUTO_TEST_CASE(blockchain)
BOOST_CHECK(callContractFunctionWithValue("someInfo()", 28) == encodeArgs(28, 0, 1));
}
+BOOST_AUTO_TEST_CASE(msg_sig)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function foo(uint256 a) returns (bytes4 value) {
+ return msg.sig;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunctionWithValue("foo(uint256)", 13) == encodeArgs(asString(FixedHash<4>(dev::sha3("foo(uint256)")).asBytes())));
+}
+
+BOOST_AUTO_TEST_CASE(msg_sig_after_internal_call_is_same)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function boo() returns (bytes4 value) {
+ return msg.sig;
+ }
+ function foo(uint256 a) returns (bytes4 value) {
+ return boo();
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunctionWithValue("foo(uint256)", 13) == encodeArgs(asString(FixedHash<4>(dev::sha3("foo(uint256)")).asBytes())));
+}
+
BOOST_AUTO_TEST_CASE(now)
{
char const* sourceCode = "contract test {\n"