aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp35
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp17
2 files changed, 52 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 7ef34383..8dd5042a 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9266,6 +9266,41 @@ BOOST_AUTO_TEST_CASE(scientific_notation)
BOOST_CHECK(callContractFunction("k()") == encodeArgs(u256(-25)));
}
+BOOST_AUTO_TEST_CASE(interface)
+{
+ char const* sourceCode = R"(
+ interface I {
+ event A();
+ function f() returns (bool);
+ function() payable;
+ }
+
+ contract A is I {
+ function f() returns (bool) {
+ return g();
+ }
+
+ function g() returns (bool) {
+ return true;
+ }
+
+ function() payable {
+ }
+ }
+
+ contract C {
+ function f(address _interfaceAddress) returns (bool) {
+ I i = I(_interfaceAddress);
+ return i.f();
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "A");
+ u160 const recipient = m_contractAddress;
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f(address)", recipient) == encodeArgs(true));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 39306f84..2a0f342c 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5435,6 +5435,23 @@ BOOST_AUTO_TEST_CASE(using_interface)
success(text);
}
+BOOST_AUTO_TEST_CASE(using_interface_complex)
+{
+ char const* text = R"(
+ interface I {
+ event A();
+ function f();
+ function g();
+ function();
+ }
+ contract C is I {
+ function f() {
+ }
+ }
+ )";
+ success(text);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}