aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-01-27 19:46:36 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-01 20:23:47 +0800
commit0b61f13c7f83667c524197fcfd53f04ab7645e1e (patch)
tree2ee5d143216c24f26a21d226edd7bee956bcd851 /test/libsolidity/SolidityEndToEndTest.cpp
parentef7add8c2bfacea43aa32455c80ac9575aa46a67 (diff)
downloaddexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar.gz
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar.bz2
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar.lz
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar.xz
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.tar.zst
dexon-solidity-0b61f13c7f83667c524197fcfd53f04ab7645e1e.zip
Add more tests for function type conversion
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 4075a016..4924b55d 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -8462,6 +8462,25 @@ BOOST_AUTO_TEST_CASE(function_array_cross_calls)
BOOST_CHECK(callContractFunction("test()") == encodeArgs(u256(5), u256(6), u256(7)));
}
+BOOST_AUTO_TEST_CASE(external_function_to_address)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (bool) {
+ return address(this.f) == address(this);
+ }
+ function g(function() external cb) returns (address) {
+ return address(cb);
+ }
+ }
+ )";
+
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(true));
+ BOOST_CHECK(callContractFunction("g(function)", fromHex("00000000000000000000000000000000000004226121ff00000000000000000")) == encodeArgs(u160(0x42)));
+}
+
+
BOOST_AUTO_TEST_CASE(copy_internal_function_array_to_storage)
{
char const* sourceCode = R"(