Conflicts:
	test/libsolidity/SolidityEndToEndTest.cpp
This commit is contained in:
LianaHus 2015-09-17 15:15:36 +02:00
parent 352c196eb3
commit e89b8d516b

View File

@ -5283,6 +5283,51 @@ BOOST_AUTO_TEST_CASE(simple_throw)
BOOST_CHECK(callContractFunction("f(uint256)", u256(1)) == encodeArgs()); BOOST_CHECK(callContractFunction("f(uint256)", u256(1)) == encodeArgs());
} }
BOOST_AUTO_TEST_CASE(strings_in_struct)
{
char const* sourceCode = R"(
contract buggystruct {
Buggy public bug;
struct Buggy {
uint first;
uint second;
uint third;
string last;
}
function buggystruct(){
bug = Buggy(10, 20, 30, "a");
}
function getFirst() returns (uint)
{
return bug.first;
}
function getSecond() returns (uint)
{
return bug.second;
}
function getThird() returns (uint)
{
return bug.third;
}
function getLast() returns (string)
{
return bug.last;
}
}
)";
compileAndRun(sourceCode);
auto first = callContractFunction("getFirst()");
BOOST_CHECK(callContractFunction("getFirst()") == encodeArgs(u256(10)));
auto second = callContractFunction("getSecond()");
BOOST_CHECK(callContractFunction("getSecond()") == encodeArgs(u256(20)));
auto third = callContractFunction("getThird()");
BOOST_CHECK(callContractFunction("getThird()") == encodeArgs(u256(30)));
auto last = callContractFunction("getLast()");
BOOST_CHECK(callContractFunction("getLast()") == encodeArgs(string("a")));
}
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
} }