aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-14 00:36:00 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-16 19:59:56 +0800
commit55fed7d1c443394372bcb36de3a586418c82163a (patch)
treec0ce2174cf74386865e10320a68736e9100f6874 /SolidityEndToEndTest.cpp
parent1cd179f0d2cec70afdde843927b68c16027f2b0c (diff)
downloaddexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar.gz
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar.bz2
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar.lz
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar.xz
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.tar.zst
dexon-solidity-55fed7d1c443394372bcb36de3a586418c82163a.zip
Adding msg.sig Solidity Magic type
msg.sig will return a bytes4 with the function signature located in CALLDATALOAD
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r--SolidityEndToEndTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 2f965849..c6183345 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -1031,6 +1031,19 @@ 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(now)
{
char const* sourceCode = "contract test {\n"