mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixes
added more tests
This commit is contained in:
parent
5c0fe54f3f
commit
377e543558
@ -973,23 +973,31 @@ BOOST_AUTO_TEST_CASE(array_accessor)
|
||||
uint[8] public data;
|
||||
uint[] public dynamicData;
|
||||
uint24[] public smallTypeData;
|
||||
struct st { uint a; uint[] finalArray; }
|
||||
mapping(uint256 => mapping(uint256 => st[5])) public multiple_map;
|
||||
|
||||
function test() {
|
||||
data[2] = 8;
|
||||
data[0] = 8;
|
||||
dynamicData.length = 3;
|
||||
dynamicData[2] = 8;
|
||||
smallTypeData.length = 2;
|
||||
smallTypeData[1] = 2;
|
||||
smallTypeData.length = 128;
|
||||
smallTypeData[1] = 22;
|
||||
smallTypeData[127] = 2;
|
||||
multiple_map[2][1][2].a = 3;
|
||||
multiple_map[2][1][2].finalArray.length = 4;
|
||||
multiple_map[2][1][2].finalArray[3] = 5;
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
auto res = callContractFunction("data(uint256)", 2) ;
|
||||
BOOST_CHECK(callContractFunction("data(uint256)", 2) == encodeArgs(8));
|
||||
BOOST_CHECK(callContractFunction("data(uint256)", 0) == encodeArgs(8));
|
||||
BOOST_CHECK(callContractFunction("data(uint256)", 8) == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("dynamicData(uint256)", 2) == encodeArgs(8));
|
||||
BOOST_CHECK(callContractFunction("dynamicData(uint256)", 8) == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("smallTypeData(uint256)", 1) == encodeArgs(2));
|
||||
BOOST_CHECK(callContractFunction("smallTypeData(uint256)", 8) == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("smallTypeData(uint256)", 1) == encodeArgs(22));
|
||||
BOOST_CHECK(callContractFunction("smallTypeData(uint256)", 127) == encodeArgs(2));
|
||||
BOOST_CHECK(callContractFunction("smallTypeData(uint256)", 128) == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("multiple_map(uint256,uint256,uint256)", 2, 1, 2) == encodeArgs(3));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(accessors_mapping_for_array)
|
||||
|
Loading…
Reference in New Issue
Block a user