Merge pull request #623 from chriseth/sol_constructorChecks

Checks for the constructor and ability to call functions
This commit is contained in:
chriseth 2014-12-17 15:18:49 +01:00
commit 8e87e85937

View File

@ -1112,6 +1112,23 @@ BOOST_AUTO_TEST_CASE(constructor_arguments)
BOOST_REQUIRE(callContractFunction(1) == bytes({'a', 'b', 'c'}));
}
BOOST_AUTO_TEST_CASE(functions_called_by_constructor)
{
char const* sourceCode = R"(
contract Test {
string3 name;
bool flag;
function Test() {
setName("abc");
}
function getName() returns (string3 ret) { return name; }
private:
function setName(string3 _name) { name = _name; }
})";
compileAndRun(sourceCode);
BOOST_REQUIRE(callContractFunction(0) == bytes({'a', 'b', 'c'}));
}
BOOST_AUTO_TEST_SUITE_END()
}