Add a test for a struct accessor.

This commit is contained in:
chriseth 2016-06-02 19:03:05 +02:00
parent 754a992500
commit 1c3a64026b

View File

@ -6812,6 +6812,32 @@ BOOST_AUTO_TEST_CASE(skip_dynamic_types)
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(7), u256(8)));
}
BOOST_AUTO_TEST_CASE(skip_dynamic_types_for_structs)
{
// For accessors, the dynamic types are already removed in the external signature itself.
char const* sourceCode = R"(
contract C {
struct S {
uint x;
string a; // this is present in the accessor
uint[] b; // this is not present
uint y;
}
S public s;
function g() returns (uint, uint) {
s.x = 2;
s.a = "abc";
s.b = [7, 8, 9];
s.y = 6;
var (x, a, y) = this.s();
return (x, y);
}
}
)";
compileAndRun(sourceCode, 0, "C");
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2), u256(6)));
}
BOOST_AUTO_TEST_SUITE_END()
}