mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
test
Conflicts: test/libsolidity/SolidityEndToEndTest.cpp
This commit is contained in:
parent
352c196eb3
commit
e89b8d516b
@ -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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user