Test cases.

This commit is contained in:
chriseth 2016-08-26 16:56:36 +02:00
parent 4bfe09897e
commit 546aca2a3e
2 changed files with 23 additions and 0 deletions

View File

@ -2541,6 +2541,19 @@ BOOST_AUTO_TEST_CASE(inherited_fallback_function)
BOOST_CHECK(callContractFunction("getData()") == encodeArgs(1)); BOOST_CHECK(callContractFunction("getData()") == encodeArgs(1));
} }
BOOST_AUTO_TEST_CASE(default_fallback_throws)
{
char const* sourceCode = R"(
contract A {
function f() returns (bool) {
return this.call();
}
}
)";
compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("f()") == encodeArgs(0));
}
BOOST_AUTO_TEST_CASE(event) BOOST_AUTO_TEST_CASE(event)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(

View File

@ -1102,6 +1102,16 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_arguments)
BOOST_CHECK(expectError(text) == Error::Type::TypeError); BOOST_CHECK(expectError(text) == Error::Type::TypeError);
} }
BOOST_AUTO_TEST_CASE(fallback_function_in_library)
{
char const* text = R"(
library C {
function() {}
}
)";
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}
BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters) BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters)
{ {
char const* text = R"( char const* text = R"(