mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4150 from ethereum/isoltest
Tidy up tests to always have closing braces on the proper line
This commit is contained in:
commit
4d7b092cb4
@ -177,7 +177,8 @@ BOOST_AUTO_TEST_CASE(conditional_expression_with_return_values)
|
|||||||
function f(bool cond, uint v) returns (uint a, uint b) {
|
function f(bool cond, uint v) returns (uint a, uint b) {
|
||||||
cond ? a = v : b = v;
|
cond ? a = v : b = v;
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("f(bool,uint256)", true, u256(20)), encodeArgs(u256(20), u256(0)));
|
ABI_CHECK(callContractFunction("f(bool,uint256)", true, u256(20)), encodeArgs(u256(20), u256(0)));
|
||||||
ABI_CHECK(callContractFunction("f(bool,uint256)", false, u256(20)), encodeArgs(u256(0), u256(20)));
|
ABI_CHECK(callContractFunction("f(bool,uint256)", false, u256(20)), encodeArgs(u256(0), u256(20)));
|
||||||
@ -2216,7 +2217,8 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls)
|
|||||||
function setHelper(address haddress) {
|
function setHelper(address haddress) {
|
||||||
h = Helper(haddress);
|
h = Helper(haddress);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2246,7 +2248,8 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_complex_parameters)
|
|||||||
function setHelper(address haddress) {
|
function setHelper(address haddress) {
|
||||||
h = Helper(haddress);
|
h = Helper(haddress);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2277,7 +2280,8 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_accessing_this)
|
|||||||
function setHelper(address addr) {
|
function setHelper(address addr) {
|
||||||
h = Helper(addr);
|
h = Helper(addr);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2308,7 +2312,8 @@ BOOST_AUTO_TEST_CASE(calls_to_this)
|
|||||||
function setHelper(address addr) {
|
function setHelper(address addr) {
|
||||||
h = Helper(addr);
|
h = Helper(addr);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2343,7 +2348,8 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_local_vars)
|
|||||||
function setHelper(address haddress) {
|
function setHelper(address haddress) {
|
||||||
h = Helper(haddress);
|
h = Helper(haddress);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2373,7 +2379,8 @@ BOOST_AUTO_TEST_CASE(fixed_bytes_in_calls)
|
|||||||
function setHelper(address addr) {
|
function setHelper(address addr) {
|
||||||
h = Helper(addr);
|
h = Helper(addr);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Helper");
|
compileAndRun(sourceCode, 0, "Helper");
|
||||||
u160 const c_helperAddress = m_contractAddress;
|
u160 const c_helperAddress = m_contractAddress;
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
@ -2403,7 +2410,8 @@ BOOST_AUTO_TEST_CASE(constructor_arguments_internal)
|
|||||||
}
|
}
|
||||||
function getFlag() returns (bool ret) { return h.getFlag(); }
|
function getFlag() returns (bool ret) { return h.getFlag(); }
|
||||||
function getName() returns (bytes3 ret) { return h.getName(); }
|
function getName() returns (bytes3 ret) { return h.getName(); }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 0, "Main");
|
compileAndRun(sourceCode, 0, "Main");
|
||||||
ABI_CHECK(callContractFunction("getFlag()"), encodeArgs(true));
|
ABI_CHECK(callContractFunction("getFlag()"), encodeArgs(true));
|
||||||
ABI_CHECK(callContractFunction("getName()"), encodeArgs("abc"));
|
ABI_CHECK(callContractFunction("getName()"), encodeArgs("abc"));
|
||||||
@ -2506,7 +2514,8 @@ BOOST_AUTO_TEST_CASE(functions_called_by_constructor)
|
|||||||
}
|
}
|
||||||
function getName() returns (bytes3 ret) { return name; }
|
function getName() returns (bytes3 ret) { return name; }
|
||||||
function setName(bytes3 _name) private { name = _name; }
|
function setName(bytes3 _name) private { name = _name; }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc"));
|
BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc"));
|
||||||
}
|
}
|
||||||
@ -2632,7 +2641,8 @@ BOOST_AUTO_TEST_CASE(value_for_constructor)
|
|||||||
function getFlag() returns (bool ret) { return h.getFlag(); }
|
function getFlag() returns (bool ret) { return h.getFlag(); }
|
||||||
function getName() returns (bytes3 ret) { return h.getName(); }
|
function getName() returns (bytes3 ret) { return h.getName(); }
|
||||||
function getBalances() returns (uint me, uint them) { me = this.balance; them = h.balance;}
|
function getBalances() returns (uint me, uint them) { me = this.balance; them = h.balance;}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode, 22, "Main");
|
compileAndRun(sourceCode, 22, "Main");
|
||||||
BOOST_REQUIRE(callContractFunction("getFlag()") == encodeArgs(true));
|
BOOST_REQUIRE(callContractFunction("getFlag()") == encodeArgs(true));
|
||||||
BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc"));
|
BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc"));
|
||||||
@ -3737,7 +3747,8 @@ BOOST_AUTO_TEST_CASE(sha3_multiple_arguments)
|
|||||||
{
|
{
|
||||||
d = sha3(a, b, c);
|
d = sha3(a, b, c);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
|
|
||||||
ABI_CHECK(callContractFunction("foo(uint256,uint256,uint256)", 10, 12, 13), encodeArgs(
|
ABI_CHECK(callContractFunction("foo(uint256,uint256,uint256)", 10, 12, 13), encodeArgs(
|
||||||
@ -4404,7 +4415,8 @@ BOOST_AUTO_TEST_CASE(inline_member_init)
|
|||||||
b = m_b;
|
b = m_b;
|
||||||
c = m_c;
|
c = m_c;
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("get()"), encodeArgs(5, 6, 8));
|
ABI_CHECK(callContractFunction("get()"), encodeArgs(5, 6, 8));
|
||||||
}
|
}
|
||||||
@ -4421,7 +4433,8 @@ BOOST_AUTO_TEST_CASE(inline_member_init_inheritence)
|
|||||||
function Derived(){}
|
function Derived(){}
|
||||||
uint m_derived = 6;
|
uint m_derived = 6;
|
||||||
function getDMember() returns (uint i) { return m_derived; }
|
function getDMember() returns (uint i) { return m_derived; }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("getBMember()"), encodeArgs(5));
|
ABI_CHECK(callContractFunction("getBMember()"), encodeArgs(5));
|
||||||
ABI_CHECK(callContractFunction("getDMember()"), encodeArgs(6));
|
ABI_CHECK(callContractFunction("getDMember()"), encodeArgs(6));
|
||||||
@ -4437,7 +4450,8 @@ BOOST_AUTO_TEST_CASE(inline_member_init_inheritence_without_constructor)
|
|||||||
contract Derived is Base {
|
contract Derived is Base {
|
||||||
uint m_derived = 6;
|
uint m_derived = 6;
|
||||||
function getDMember() returns (uint i) { return m_derived; }
|
function getDMember() returns (uint i) { return m_derived; }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("getBMember()"), encodeArgs(5));
|
ABI_CHECK(callContractFunction("getBMember()"), encodeArgs(5));
|
||||||
ABI_CHECK(callContractFunction("getDMember()"), encodeArgs(6));
|
ABI_CHECK(callContractFunction("getDMember()"), encodeArgs(6));
|
||||||
@ -5303,7 +5317,8 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base)
|
|||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
contract Final is Derived(4) {
|
contract Final is Derived(4) {
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
||||||
}
|
}
|
||||||
@ -5326,7 +5341,8 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base)
|
|||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
contract Final is Derived(4) {
|
contract Final is Derived(4) {
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
||||||
}
|
}
|
||||||
@ -5346,7 +5362,8 @@ BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base_with_gap)
|
|||||||
function Derived(uint i) Base(i) {}
|
function Derived(uint i) Base(i) {}
|
||||||
}
|
}
|
||||||
contract Final is Derived(4) {
|
contract Final is Derived(4) {
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
ABI_CHECK(callContractFunction("m_i()"), encodeArgs(4));
|
||||||
}
|
}
|
||||||
@ -5357,7 +5374,8 @@ BOOST_AUTO_TEST_CASE(simple_constant_variables_test)
|
|||||||
contract Foo {
|
contract Foo {
|
||||||
function getX() returns (uint r) { return x; }
|
function getX() returns (uint r) { return x; }
|
||||||
uint constant x = 56;
|
uint constant x = 56;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
ABI_CHECK(callContractFunction("getX()"), encodeArgs(56));
|
ABI_CHECK(callContractFunction("getX()"), encodeArgs(56));
|
||||||
}
|
}
|
||||||
@ -5370,7 +5388,8 @@ BOOST_AUTO_TEST_CASE(constant_variables)
|
|||||||
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
ActionChoices constant choices = ActionChoices.GoLeft;
|
ActionChoices constant choices = ActionChoices.GoLeft;
|
||||||
bytes32 constant st = "abc\x00\xff__";
|
bytes32 constant st = "abc\x00\xff__";
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,8 @@ BOOST_AUTO_TEST_CASE(int_with_finney_ether_subdenomination)
|
|||||||
{
|
{
|
||||||
var x = 1 finney;
|
var x = 1 finney;
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
bytes code = compileFirstExpression(sourceCode);
|
bytes code = compileFirstExpression(sourceCode);
|
||||||
|
|
||||||
bytes expectation({byte(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
|
bytes expectation({byte(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
|
||||||
|
@ -139,7 +139,8 @@ BOOST_AUTO_TEST_CASE(smoke_test)
|
|||||||
function f(uint a) returns (uint b) {
|
function f(uint a) returns (uint b) {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f(uint256)", u256(7));
|
compareVersions("f(uint256)", u256(7));
|
||||||
}
|
}
|
||||||
@ -151,7 +152,8 @@ BOOST_AUTO_TEST_CASE(identities)
|
|||||||
function f(int a) returns (int b) {
|
function f(int a) returns (int b) {
|
||||||
return int(0) | (int(1) * (int(0) ^ (0 + a)));
|
return int(0) | (int(1) * (int(0) ^ (0 + a)));
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f(int256)", u256(0x12334664));
|
compareVersions("f(int256)", u256(0x12334664));
|
||||||
}
|
}
|
||||||
@ -165,7 +167,8 @@ BOOST_AUTO_TEST_CASE(unused_expressions)
|
|||||||
10 + 20;
|
10 + 20;
|
||||||
data;
|
data;
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f()");
|
compareVersions("f()");
|
||||||
}
|
}
|
||||||
@ -180,7 +183,8 @@ BOOST_AUTO_TEST_CASE(constant_folding_both_sides)
|
|||||||
function f(uint x) returns (uint y) {
|
function f(uint x) returns (uint y) {
|
||||||
return 98 ^ (7 * ((1 | (x | 1000)) * 40) ^ 102);
|
return 98 ^ (7 * ((1 | (x | 1000)) * 40) ^ 102);
|
||||||
}
|
}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
compileBothVersions(sourceCode);
|
compileBothVersions(sourceCode);
|
||||||
compareVersions("f(uint256)", 7);
|
compareVersions("f(uint256)", 7);
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,8 @@ BOOST_AUTO_TEST_CASE(event)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
event e();
|
event e();
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +743,8 @@ BOOST_AUTO_TEST_CASE(event_arguments)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
event e(uint a, bytes32 s);
|
event e(uint a, bytes32 s);
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,7 +753,8 @@ BOOST_AUTO_TEST_CASE(event_arguments_indexed)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
event e(uint a, bytes32 indexed s, bool indexed b);
|
event e(uint a, bytes32 indexed s, bool indexed b);
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +770,8 @@ BOOST_AUTO_TEST_CASE(visibility_specifiers)
|
|||||||
function f_priv() private {}
|
function f_priv() private {}
|
||||||
function f_public() public {}
|
function f_public() public {}
|
||||||
function f_internal() internal {}
|
function f_internal() internal {}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,12 +780,14 @@ BOOST_AUTO_TEST_CASE(multiple_visibility_specifiers)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
uint private internal a;
|
uint private internal a;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
||||||
text = R"(
|
text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
function f() private external {}
|
function f() private external {}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,7 +806,8 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations)
|
|||||||
uint256 b;
|
uint256 b;
|
||||||
uint256 c;
|
uint256 c;
|
||||||
uint256 d;
|
uint256 d;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,7 +820,8 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression
|
|||||||
a = 1 wei * 100 wei + 7 szabo - 3;
|
a = 1 wei * 100 wei + 7 szabo - 3;
|
||||||
}
|
}
|
||||||
uint256 a;
|
uint256 a;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +835,8 @@ BOOST_AUTO_TEST_CASE(enum_valid_declaration)
|
|||||||
a = foo.Value3;
|
a = foo.Value3;
|
||||||
}
|
}
|
||||||
uint256 a;
|
uint256 a;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,7 +845,8 @@ BOOST_AUTO_TEST_CASE(external_function)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
function x() external {}
|
function x() external {}
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,7 +858,8 @@ BOOST_AUTO_TEST_CASE(arrays_in_storage)
|
|||||||
uint[] a2;
|
uint[] a2;
|
||||||
struct x { uint[2**20] b; y[0] c; }
|
struct x { uint[2**20] b; y[0] c; }
|
||||||
struct y { uint d; mapping(uint=>x)[] e; }
|
struct y { uint d; mapping(uint=>x)[] e; }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,7 +868,8 @@ BOOST_AUTO_TEST_CASE(arrays_in_events)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
event e(uint[10] a, bytes7[8] indexed b, c[3] x);
|
event e(uint[10] a, bytes7[8] indexed b, c[3] x);
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,7 +878,8 @@ BOOST_AUTO_TEST_CASE(arrays_in_expressions)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
function f() { c[10] a = 7; uint8[10 * 2] x; }
|
function f() { c[10] a = 7; uint8[10 * 2] x; }
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +888,8 @@ BOOST_AUTO_TEST_CASE(multi_arrays)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract c {
|
contract c {
|
||||||
mapping(uint => mapping(uint => int8)[8][][9])[] x;
|
mapping(uint => mapping(uint => int8)[8][][9])[] x;
|
||||||
})";
|
}
|
||||||
|
)";
|
||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ void SyntaxTestTool::printContract() const
|
|||||||
for (auto const& error: m_test->errorList())
|
for (auto const& error: m_test->errorList())
|
||||||
if (error.locationStart >= 0 && error.locationEnd >= 0)
|
if (error.locationStart >= 0 && error.locationEnd >= 0)
|
||||||
{
|
{
|
||||||
assert(static_cast<size_t>(error.locationStart) < source.length());
|
assert(static_cast<size_t>(error.locationStart) <= source.length());
|
||||||
assert(static_cast<size_t>(error.locationEnd) < source.length());
|
assert(static_cast<size_t>(error.locationEnd) <= source.length());
|
||||||
bool isWarning = error.type == "Warning";
|
bool isWarning = error.type == "Warning";
|
||||||
for (int i = error.locationStart; i < error.locationEnd; i++)
|
for (int i = error.locationStart; i < error.locationEnd; i++)
|
||||||
if (isWarning)
|
if (isWarning)
|
||||||
|
Loading…
Reference in New Issue
Block a user