diff options
author | LianaHus <liana@ethdev.com> | 2015-10-15 22:46:02 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-10-15 22:46:02 +0800 |
commit | 292fb473bf125ed513e1a12a70d162ebd055e380 (patch) | |
tree | 40b1a19d2b93a307bd5561f07660ffc1e49c02bc /test | |
parent | 162d021c3faf0fdb671778870c9da8ad74256b2e (diff) | |
download | dexon-solidity-292fb473bf125ed513e1a12a70d162ebd055e380.tar.gz dexon-solidity-292fb473bf125ed513e1a12a70d162ebd055e380.tar.zst dexon-solidity-292fb473bf125ed513e1a12a70d162ebd055e380.zip |
renaming in test framework
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 390 |
1 files changed, 195 insertions, 195 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 909ec303..2558ba97 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -101,7 +101,7 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false) return make_pair(sourceUnit, nullptr); } -ASTPointer<SourceUnit> createSourceUnit(string const& _source) +ASTPointer<SourceUnit> parseAndAnalyse(string const& _source) { auto sourceAndError = parseAnalyseAndReturnError(_source); BOOST_REQUIRE(!!sourceAndError.first); @@ -109,7 +109,7 @@ ASTPointer<SourceUnit> createSourceUnit(string const& _source) return sourceAndError.first; } -bool successResolving(std::string const& _source) +bool success(std::string const& _source) { auto sourceAndError = parseAnalyseAndReturnError(_source); @@ -118,7 +118,7 @@ bool successResolving(std::string const& _source) return true; } -Error::Type parseAndAnalyseReturnErrorType(std::string const& _source, bool _warning = false) +Error::Type expectError(std::string const& _source, bool _warning = false) { auto sourceAndError = parseAnalyseAndReturnError(_source, _warning); BOOST_REQUIRE(!!sourceAndError.second); @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) " uint256 stateVariable1;\n" " function fun(uint256 arg1) { uint256 y; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(double_stateVariable_declaration) @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(double_stateVariable_declaration) " uint256 variable;\n" " uint128 variable;\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(double_function_declaration) @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(double_function_declaration) " function fun() { uint x; }\n" " function fun() { uint x; }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(double_variable_declaration) @@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(double_variable_declaration) char const* text = "contract test {\n" " function f() { uint256 x; if (true) { uint256 x; } }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(name_shadowing) @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(name_shadowing) " uint256 variable;\n" " function f() { uint32 variable ; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(name_references) @@ -200,7 +200,7 @@ BOOST_AUTO_TEST_CASE(name_references) " uint256 variable;\n" " function f(uint256 arg) returns (uint out) { f(variable); test; out; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(undeclared_name) @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(undeclared_name) " uint256 variable;\n" " function f(uint256 arg) { f(notfound); }" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(reference_to_later_declaration) @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(reference_to_later_declaration) " function g() { f(); }" " function f() { }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(struct_definition_directly_recursive) @@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_directly_recursive) " MyStructName x;\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive) @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive) " MyStructName1 x;\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_definition_not_really_recursive) @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_not_really_recursive) struct s2 { s1 x; s1 y; } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(struct_definition_recursion_via_mapping) @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_recursion_via_mapping) " mapping(uint => MyStructName1) x;\n" " }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(type_inference_smoke_test) @@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE(type_inference_smoke_test) char const* text = "contract test {\n" " function f(uint256 arg1, uint32 arg2) returns (bool ret) { var x = arg1 + arg2 == 8; ret = x; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(type_checking_return) @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return) char const* text = "contract test {\n" " function f() returns (bool r) { return 1 >= 2; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(type_checking_return_wrong_number) @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return_wrong_number) char const* text = "contract test {\n" " function f() returns (bool r1, bool r2) { return 1 >= 2; }" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_checking_return_wrong_type) @@ -299,7 +299,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return_wrong_type) char const* text = "contract test {\n" " function f() returns (uint256 r) { return 1 >= 2; }" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_checking_function_call) @@ -308,7 +308,7 @@ BOOST_AUTO_TEST_CASE(type_checking_function_call) " function f() returns (bool r) { return g(12, true) == 3; }\n" " function g(uint256 a, bool b) returns (uint256 r) { }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) @@ -316,7 +316,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) char const* text = "contract test {\n" " function f() { uint32(2) == int64(2); }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) @@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) char const* text = "contract test {\n" " function f() { int32(2) == uint64(2); }" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) @@ -332,7 +332,7 @@ BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) char const* text = "contract test {\n" " function f() returns (int256 r) { var x = int256(uint32(2)); return x; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(large_string_literal) @@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(large_string_literal) char const* text = "contract test {\n" " function f() { var x = \"123456789012345678901234567890123\"; }" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(balance) @@ -350,7 +350,7 @@ BOOST_AUTO_TEST_CASE(balance) " uint256 x = address(0).balance;\n" " }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(balance_invalid) @@ -360,7 +360,7 @@ BOOST_AUTO_TEST_CASE(balance_invalid) " address(0).balance = 7;\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_to_mapping) @@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(assignment_to_mapping) " data.map = a;\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_to_struct) @@ -390,7 +390,7 @@ BOOST_AUTO_TEST_CASE(assignment_to_struct) " data = a;\n" " }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(returns_in_constructor) @@ -399,7 +399,7 @@ BOOST_AUTO_TEST_CASE(returns_in_constructor) " function test() returns (uint a) {\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(forward_function_reference) @@ -414,7 +414,7 @@ BOOST_AUTO_TEST_CASE(forward_function_reference) " if (First(2).fun() == true) return 1;\n" " }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(comparison_bitop_precedence) @@ -424,7 +424,7 @@ BOOST_AUTO_TEST_CASE(comparison_bitop_precedence) " return 1 & 2 == 8 & 9 && 1 ^ 2 < 4 | 6;\n" " }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(function_no_implementation) @@ -433,7 +433,7 @@ BOOST_AUTO_TEST_CASE(function_no_implementation) char const* text = "contract test {\n" " function functionName(bytes32 input) returns (bytes32 out);\n" "}\n"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* contract = dynamic_cast<ContractDefinition*>(nodes[0].get()); BOOST_CHECK(contract); @@ -448,7 +448,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract) contract base { function foo(); } contract derived is base { function foo() {} } )"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[0].get()); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get()); @@ -467,7 +467,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract_with_overload) contract base { function foo(bool); } contract derived is base { function foo(uint) {} } )"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[0].get()); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get()); @@ -487,7 +487,7 @@ BOOST_AUTO_TEST_CASE(create_abstract_contract) function foo() { b = new base();} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_optional) @@ -501,7 +501,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_optional) function foo() {} } )"; - ETH_TEST_REQUIRE_NO_THROW(createSourceUnit(text), "Parsing and name resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(parseAndAnalyse(text), "Parsing and name resolving failed"); } BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_not_provided) @@ -515,7 +515,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_not_provided) function foo() {} } )"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name resolving failed"); std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); BOOST_CHECK_EQUAL(nodes.size(), 3); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get()); @@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE(redeclare_implemented_abstract_function_as_abstract) contract derived is base { function foo() {} } contract wrong is derived { function foo(); } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_canonical_signature) @@ -542,7 +542,7 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature) " ret = arg1 + arg2;\n" " }\n" "}\n"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { @@ -559,7 +559,7 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature_type_aliases) " ret = 5;\n" " }\n" "}\n"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { @@ -582,7 +582,7 @@ BOOST_AUTO_TEST_CASE(function_external_types) ret = 5; } })"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { @@ -604,7 +604,7 @@ BOOST_AUTO_TEST_CASE(enum_external_type) ret = 5; } })"; - ETH_TEST_REQUIRE_NO_THROW(sourceUnit = createSourceUnit(text), "Parsing and name Resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseAndAnalyse(text), "Parsing and name Resolving failed"); for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { @@ -626,7 +626,7 @@ BOOST_AUTO_TEST_CASE(function_external_call_allowed_conversion) } function g (C c) external {} })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(function_external_call_not_allowed_conversion) @@ -640,7 +640,7 @@ BOOST_AUTO_TEST_CASE(function_external_call_not_allowed_conversion) } function g (C c) external {} })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_internal_allowed_conversion) @@ -656,7 +656,7 @@ BOOST_AUTO_TEST_CASE(function_internal_allowed_conversion) g(a); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(function_internal_not_allowed_conversion) @@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(function_internal_not_allowed_conversion) g(a); } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(hash_collision_in_interface) @@ -683,7 +683,7 @@ BOOST_AUTO_TEST_CASE(hash_collision_in_interface) " function tgeo() {\n" " }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(inheritance_basic) @@ -695,7 +695,7 @@ BOOST_AUTO_TEST_CASE(inheritance_basic) function f() { baseMember = 7; } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(inheritance_diamond_basic) @@ -708,7 +708,7 @@ BOOST_AUTO_TEST_CASE(inheritance_diamond_basic) function g() { f(); rootFunction(); } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(cyclic_inheritance) @@ -717,7 +717,7 @@ BOOST_AUTO_TEST_CASE(cyclic_inheritance) contract A is B { } contract B is A { } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(legal_override_direct) @@ -726,7 +726,7 @@ BOOST_AUTO_TEST_CASE(legal_override_direct) contract B { function f() {} } contract C is B { function f(uint i) {} } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(legal_override_indirect) @@ -736,7 +736,7 @@ BOOST_AUTO_TEST_CASE(legal_override_indirect) contract B { function f() {} } contract C is A, B { } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(illegal_override_visibility) @@ -745,7 +745,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_visibility) contract B { function f() internal {} } contract C is B { function f() public {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(illegal_override_constness) @@ -754,7 +754,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_constness) contract B { function f() constant {} } contract C is B { function f() {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(complex_inheritance) @@ -764,7 +764,7 @@ BOOST_AUTO_TEST_CASE(complex_inheritance) contract B { function f() {} function g() returns (uint8 r) {} } contract C is A, B { } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(constructor_visibility) @@ -774,7 +774,7 @@ BOOST_AUTO_TEST_CASE(constructor_visibility) contract A { function A() { } } contract B is A { function f() { A x = A(0); } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(overriding_constructor) @@ -784,7 +784,7 @@ BOOST_AUTO_TEST_CASE(overriding_constructor) contract A { function A() { } } contract B is A { function A() returns (uint8 r) {} } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(missing_base_constructor_arguments) @@ -793,7 +793,7 @@ BOOST_AUTO_TEST_CASE(missing_base_constructor_arguments) contract A { function A(uint a) { } } contract B is A { } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(base_constructor_arguments_override) @@ -802,7 +802,7 @@ BOOST_AUTO_TEST_CASE(base_constructor_arguments_override) contract A { function A(uint a) { } } contract B is A { } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(implicit_derived_to_base_conversion) @@ -813,7 +813,7 @@ BOOST_AUTO_TEST_CASE(implicit_derived_to_base_conversion) function f() { A a = B(1); } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(implicit_base_to_derived_conversion) @@ -824,7 +824,7 @@ BOOST_AUTO_TEST_CASE(implicit_base_to_derived_conversion) function f() { B b = A(1); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_modifier_invocation) @@ -836,7 +836,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation) modifier mod2(bytes7 a) { while (a == "1234567") _ } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(invalid_function_modifier_type) @@ -847,7 +847,7 @@ BOOST_AUTO_TEST_CASE(invalid_function_modifier_type) modifier mod1(uint a) { if (a > 0) _ } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_modifier_invocation_parameters) @@ -859,7 +859,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation_parameters) modifier mod2(bytes7 a) { while (a == "1234567") _ } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(function_modifier_invocation_local_variables) @@ -870,7 +870,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation_local_variables) modifier mod(uint a) { if (a > 0) _ } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(legal_modifier_override) @@ -879,7 +879,7 @@ BOOST_AUTO_TEST_CASE(legal_modifier_override) contract A { modifier mod(uint a) {} } contract B is A { modifier mod(uint a) {} } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(illegal_modifier_override) @@ -888,7 +888,7 @@ BOOST_AUTO_TEST_CASE(illegal_modifier_override) contract A { modifier mod(uint a) {} } contract B is A { modifier mod(uint8 a) {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(modifier_overrides_function) @@ -897,7 +897,7 @@ BOOST_AUTO_TEST_CASE(modifier_overrides_function) contract A { modifier mod(uint a) {} } contract B is A { function mod(uint a) {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_overrides_modifier) @@ -906,7 +906,7 @@ BOOST_AUTO_TEST_CASE(function_overrides_modifier) contract A { function mod(uint a) {} } contract B is A { modifier mod(uint a) {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(modifier_returns_value) @@ -917,7 +917,7 @@ BOOST_AUTO_TEST_CASE(modifier_returns_value) modifier mod(uint a) { return 7; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(state_variable_accessors) @@ -933,7 +933,7 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) ASTPointer<SourceUnit> source; ContractDefinition const* contract; - ETH_TEST_CHECK_NO_THROW(source = createSourceUnit(text), "Parsing and Resolving names failed"); + ETH_TEST_CHECK_NO_THROW(source = parseAndAnalyse(text), "Parsing and Resolving names failed"); BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()"); BOOST_REQUIRE(function && function->hasDeclaration()); @@ -968,7 +968,7 @@ BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor) "uint256 foo;\n" " function foo() {}\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(private_state_variable) @@ -983,7 +983,7 @@ BOOST_AUTO_TEST_CASE(private_state_variable) ASTPointer<SourceUnit> source; ContractDefinition const* contract; - ETH_TEST_CHECK_NO_THROW(source = createSourceUnit(text), "Parsing and Resolving names failed"); + ETH_TEST_CHECK_NO_THROW(source = parseAndAnalyse(text), "Parsing and Resolving names failed"); BOOST_CHECK((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function; function = retrieveFunctionBySignature(contract, "foo()"); @@ -1001,7 +1001,7 @@ BOOST_AUTO_TEST_CASE(base_class_state_variable_accessor) "contract Child is Parent{\n" " function foo() returns (uint256) { return Parent.m_aMember; }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) @@ -1012,7 +1012,7 @@ BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) "contract Child is Parent{\n" " function foo() returns (uint256) { return Parent.m_aMember; }\n" "}\n"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class1) @@ -1026,7 +1026,7 @@ BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class1) "contract Child is Parent2{\n" " function foo() returns (uint256) { return Parent2.m_aMember1; }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class2) @@ -1041,7 +1041,7 @@ BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class2) " function foo() returns (uint256) { return Child.m_aMember2; }\n" " uint256 public m_aMember3;\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function) @@ -1052,7 +1052,7 @@ BOOST_AUTO_TEST_CASE(fallback_function) function() { x = 2; } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(fallback_function_with_arguments) @@ -1063,7 +1063,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_arguments) function(uint a) { x = 2; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(fallback_function_twice) @@ -1075,7 +1075,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_twice) function() { x = 3; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(fallback_function_inheritance) @@ -1089,7 +1089,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_inheritance) function() { x = 2; } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(event) @@ -1099,7 +1099,7 @@ BOOST_AUTO_TEST_CASE(event) event e(uint indexed a, bytes3 indexed s, bool indexed b); function f() { e(2, "abc", true); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(event_too_many_indexed) @@ -1108,7 +1108,7 @@ BOOST_AUTO_TEST_CASE(event_too_many_indexed) contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d); })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(anonymous_event_four_indexed) @@ -1117,7 +1117,7 @@ BOOST_AUTO_TEST_CASE(anonymous_event_four_indexed) contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d) anonymous; })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(anonymous_event_too_many_indexed) @@ -1126,7 +1126,7 @@ BOOST_AUTO_TEST_CASE(anonymous_event_too_many_indexed) contract c { event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(event_call) @@ -1136,7 +1136,7 @@ BOOST_AUTO_TEST_CASE(event_call) event e(uint a, bytes3 indexed s, bool indexed b); function f() { e(2, "abc", true); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(event_inheritance) @@ -1148,7 +1148,7 @@ BOOST_AUTO_TEST_CASE(event_inheritance) contract c is base { function f() { e(2, "abc", true); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(multiple_events_argument_clash) @@ -1158,7 +1158,7 @@ BOOST_AUTO_TEST_CASE(multiple_events_argument_clash) event e1(uint a, uint e1, uint e2); event e2(uint a, uint e1, uint e2); })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(access_to_default_function_visibility) @@ -1170,7 +1170,7 @@ BOOST_AUTO_TEST_CASE(access_to_default_function_visibility) contract d { function g() { c(0).f(); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(access_to_internal_function) @@ -1182,7 +1182,7 @@ BOOST_AUTO_TEST_CASE(access_to_internal_function) contract d { function g() { c(0).f(); } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(access_to_default_state_variable_visibility) @@ -1194,7 +1194,7 @@ BOOST_AUTO_TEST_CASE(access_to_default_state_variable_visibility) contract d { function g() { c(0).a(); } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(access_to_internal_state_variable) @@ -1206,7 +1206,7 @@ BOOST_AUTO_TEST_CASE(access_to_internal_state_variable) contract d { function g() { c(0).a(); } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(error_count_in_named_args) @@ -1215,7 +1215,7 @@ BOOST_AUTO_TEST_CASE(error_count_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1}); }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(empty_in_named_args) @@ -1224,7 +1224,7 @@ BOOST_AUTO_TEST_CASE(empty_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({}); }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(duplicate_parameter_names_in_named_args) @@ -1233,7 +1233,7 @@ BOOST_AUTO_TEST_CASE(duplicate_parameter_names_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1, a: 2}); }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_parameter_names_in_named_args) @@ -1242,7 +1242,7 @@ BOOST_AUTO_TEST_CASE(invalid_parameter_names_in_named_args) " function a(uint a, uint b) returns (uint r) { r = a + b; }\n" " function b() returns (uint r) { r = a({a: 1, c: 2}); }\n" "}\n"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(empty_name_input_parameter) @@ -1252,7 +1252,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter) function f(uint){ } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(empty_name_return_parameter) @@ -1262,7 +1262,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter) function f() returns(bool){ } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) @@ -1273,7 +1273,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) return k; } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(empty_name_return_parameter_with_named_one) @@ -1284,13 +1284,13 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter_with_named_one) return 5; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(disallow_declaration_of_void_type) { char const* sourceCode = "contract c { function f() { var (x) = f(); } }"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) @@ -1303,7 +1303,7 @@ BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) } uint256 a; })"; - ETH_TEST_CHECK_NO_THROW(createSourceUnit(sourceCodeFine), + ETH_TEST_CHECK_NO_THROW(parseAndAnalyse(sourceCodeFine), "Parsing and Resolving names failed"); char const* sourceCode = R"( contract c { @@ -1313,7 +1313,7 @@ BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) } uint256 a; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(exp_operator_negative_exponent) @@ -1322,7 +1322,7 @@ BOOST_AUTO_TEST_CASE(exp_operator_negative_exponent) contract test { function f() returns(uint d) { return 2 ** -3; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big) @@ -1331,7 +1331,7 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big) contract test { function f() returns(uint d) { return 2 ** 10000000000; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_member_access) @@ -1346,7 +1346,7 @@ BOOST_AUTO_TEST_CASE(enum_member_access) ActionChoices choices; } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(enum_invalid_member_access) @@ -1361,7 +1361,7 @@ BOOST_AUTO_TEST_CASE(enum_invalid_member_access) ActionChoices choices; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay) @@ -1378,7 +1378,7 @@ BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay) uint64 b; } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(int_to_enum_explicit_conversion_is_okay) @@ -1395,7 +1395,7 @@ BOOST_AUTO_TEST_CASE(int_to_enum_explicit_conversion_is_okay) ActionChoices b; } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay) @@ -1412,7 +1412,7 @@ BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay) uint64 b; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(enum_duplicate_values) @@ -1422,7 +1422,7 @@ BOOST_AUTO_TEST_CASE(enum_duplicate_values) enum ActionChoices { GoLeft, GoRight, GoLeft, Sit } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(text) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(private_visibility) @@ -1435,7 +1435,7 @@ BOOST_AUTO_TEST_CASE(private_visibility) function g() { f(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(private_visibility_via_explicit_base_access) @@ -1448,7 +1448,7 @@ BOOST_AUTO_TEST_CASE(private_visibility_via_explicit_base_access) function g() { base.f(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_visibility) @@ -1459,7 +1459,7 @@ BOOST_AUTO_TEST_CASE(external_visibility) function g() { f(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(external_base_visibility) @@ -1472,7 +1472,7 @@ BOOST_AUTO_TEST_CASE(external_base_visibility) function g() { base.f(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_assign) @@ -1482,7 +1482,7 @@ BOOST_AUTO_TEST_CASE(external_argument_assign) function f(uint a) external { a = 1; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_increment) @@ -1492,7 +1492,7 @@ BOOST_AUTO_TEST_CASE(external_argument_increment) function f(uint a) external { a++; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_argument_delete) @@ -1502,7 +1502,7 @@ BOOST_AUTO_TEST_CASE(external_argument_delete) function f(uint a) external { delete a; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(test_for_bug_override_function_with_bytearray_type) @@ -1515,7 +1515,7 @@ BOOST_AUTO_TEST_CASE(test_for_bug_override_function_with_bytearray_type) function f(bytes _a) external returns (uint256 r) {r = 42;} } )"; - ETH_TEST_CHECK_NO_THROW(createSourceUnit(sourceCode), "Parsing and Name Resolving failed"); + ETH_TEST_CHECK_NO_THROW(parseAndAnalyse(sourceCode), "Parsing and Name Resolving failed"); } BOOST_AUTO_TEST_CASE(array_with_nonconstant_length) @@ -1524,7 +1524,7 @@ BOOST_AUTO_TEST_CASE(array_with_nonconstant_length) contract c { function f(uint a) { uint8[a] x; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types1) @@ -1535,7 +1535,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types1) uint[] b; function f() { b = a; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types2) @@ -1546,7 +1546,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types2) uint8[] b; function f() { b = a; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_conversion_possible) @@ -1557,7 +1557,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_conversion_possible) uint8[] b; function f() { a = b; } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_static_dynamic) @@ -1568,7 +1568,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_static_dynamic) uint8[80] b; function f() { a = b; } })"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) @@ -1579,7 +1579,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) uint[80] b; function f() { b = a; } })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) @@ -1588,7 +1588,7 @@ BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) contract c { uint8 a = 1000; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string) @@ -1597,7 +1597,7 @@ BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string) contract c { uint a = "abc"; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(test_fromElementaryTypeName) @@ -1712,7 +1712,7 @@ BOOST_AUTO_TEST_CASE(test_byte_is_alias_of_byte1) bytes arr; function f() { byte a = arr[0];} })"; - ETH_TEST_REQUIRE_NO_THROW(createSourceUnit(text), "Type resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(parseAndAnalyse(text), "Type resolving failed"); } BOOST_AUTO_TEST_CASE(assigning_value_to_const_variable) @@ -1722,7 +1722,7 @@ BOOST_AUTO_TEST_CASE(assigning_value_to_const_variable) function changeIt() { x = 9; } uint constant x = 56; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(complex_const_variable) @@ -1732,7 +1732,7 @@ BOOST_AUTO_TEST_CASE(complex_const_variable) contract Foo { mapping(uint => bool) constant mapVar; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(uninitialized_const_variable) @@ -1741,7 +1741,7 @@ BOOST_AUTO_TEST_CASE(uninitialized_const_variable) contract Foo { uint constant y; })"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve) @@ -1753,7 +1753,7 @@ BOOST_AUTO_TEST_CASE(overloaded_function_cannot_resolve) function g() returns(uint) { return f(3, 5); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(ambiguous_overloaded_function) @@ -1766,7 +1766,7 @@ BOOST_AUTO_TEST_CASE(ambiguous_overloaded_function) function g() returns(uint) { return f(1); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_of_nonoverloaded_function) @@ -1777,7 +1777,7 @@ BOOST_AUTO_TEST_CASE(assignment_of_nonoverloaded_function) function g() returns(uint) { var x = f; return x(7); } } )"; - ETH_TEST_REQUIRE_NO_THROW(createSourceUnit(sourceCode), "Type resolving failed"); + ETH_TEST_REQUIRE_NO_THROW(parseAndAnalyse(sourceCode), "Type resolving failed"); } BOOST_AUTO_TEST_CASE(assignment_of_overloaded_function) @@ -1789,7 +1789,7 @@ BOOST_AUTO_TEST_CASE(assignment_of_overloaded_function) function g() returns(uint) { var x = f; return x(7); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(external_types_clash) @@ -1803,7 +1803,7 @@ BOOST_AUTO_TEST_CASE(external_types_clash) function f(uint8 a) { } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(override_changes_return_types) @@ -1816,7 +1816,7 @@ BOOST_AUTO_TEST_CASE(override_changes_return_types) function f(uint a) returns (uint8) { } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multiple_constructors) @@ -1827,7 +1827,7 @@ BOOST_AUTO_TEST_CASE(multiple_constructors) function test() {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(equal_overload) @@ -1838,7 +1838,7 @@ BOOST_AUTO_TEST_CASE(equal_overload) function test(uint a) external {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::DeclarationError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::DeclarationError); } BOOST_AUTO_TEST_CASE(uninitialized_var) @@ -1848,7 +1848,7 @@ BOOST_AUTO_TEST_CASE(uninitialized_var) function f() returns (uint) { var x; return 2; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string) @@ -1859,7 +1859,7 @@ BOOST_AUTO_TEST_CASE(string) function f(string x) external { s = x; } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(string_index) @@ -1870,7 +1870,7 @@ BOOST_AUTO_TEST_CASE(string_index) function f() { var a = s[2]; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string_length) @@ -1881,7 +1881,7 @@ BOOST_AUTO_TEST_CASE(string_length) function f() { var a = s.length; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(negative_integers_to_signed_out_of_bound) @@ -1891,7 +1891,7 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_signed_out_of_bound) int8 public i = -129; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(negative_integers_to_signed_min) @@ -1901,7 +1901,7 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_signed_min) int8 public i = -128; } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound) @@ -1911,7 +1911,7 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound) int8 public j = 128; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound_max) @@ -1921,7 +1921,7 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_signed_out_of_bound_max) int8 public j = 127; } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(negative_integers_to_unsigned) @@ -1931,7 +1931,7 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_unsigned) uint8 public x = -1; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound) @@ -1941,7 +1941,7 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound) uint8 public x = 700; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(integer_boolean_operators) @@ -1949,15 +1949,15 @@ BOOST_AUTO_TEST_CASE(integer_boolean_operators) char const* sourceCode1 = R"( contract test { function() { uint x = 1; uint y = 2; x || y; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode1) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); char const* sourceCode2 = R"( contract test { function() { uint x = 1; uint y = 2; x && y; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode2) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); char const* sourceCode3 = R"( contract test { function() { uint x = 1; !x; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode3) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(reference_compare_operators) @@ -1965,11 +1965,11 @@ BOOST_AUTO_TEST_CASE(reference_compare_operators) char const* sourceCode1 = R"( contract test { bytes a; bytes b; function() { a == b; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode1) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError); char const* sourceCode2 = R"( contract test { struct s {uint a;} s x; s y; function() { x == y; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode2) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overwrite_memory_location_external) @@ -1979,7 +1979,7 @@ BOOST_AUTO_TEST_CASE(overwrite_memory_location_external) function f(uint[] memory a) external {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(overwrite_storage_location_external) @@ -1989,7 +1989,7 @@ BOOST_AUTO_TEST_CASE(overwrite_storage_location_external) function f(uint[] storage a) external {} } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_location_local_variables) @@ -2003,7 +2003,7 @@ BOOST_AUTO_TEST_CASE(storage_location_local_variables) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(no_mappings_in_memory_array) @@ -2015,7 +2015,7 @@ BOOST_AUTO_TEST_CASE(no_mappings_in_memory_array) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) @@ -2029,7 +2029,7 @@ BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) @@ -2046,7 +2046,7 @@ BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(no_delete_on_storage_pointers) @@ -2060,7 +2060,7 @@ BOOST_AUTO_TEST_CASE(no_delete_on_storage_pointers) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(assignment_mem_storage_variable_directly) @@ -2073,7 +2073,7 @@ BOOST_AUTO_TEST_CASE(assignment_mem_storage_variable_directly) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(function_argument_mem_to_storage) @@ -2087,7 +2087,7 @@ BOOST_AUTO_TEST_CASE(function_argument_mem_to_storage) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(function_argument_storage_to_mem) @@ -2101,7 +2101,7 @@ BOOST_AUTO_TEST_CASE(function_argument_storage_to_mem) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(mem_array_assignment_changes_base_type) @@ -2116,7 +2116,7 @@ BOOST_AUTO_TEST_CASE(mem_array_assignment_changes_base_type) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible) @@ -2129,7 +2129,7 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(memory_arrays_not_resizeable) @@ -2142,7 +2142,7 @@ BOOST_AUTO_TEST_CASE(memory_arrays_not_resizeable) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(struct_constructor) @@ -2155,7 +2155,7 @@ BOOST_AUTO_TEST_CASE(struct_constructor) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(struct_constructor_nested) @@ -2170,7 +2170,7 @@ BOOST_AUTO_TEST_CASE(struct_constructor_nested) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(struct_named_constructor) @@ -2183,7 +2183,7 @@ BOOST_AUTO_TEST_CASE(struct_named_constructor) } } )"; - BOOST_CHECK_NO_THROW(createSourceUnit(sourceCode)); + BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); } BOOST_AUTO_TEST_CASE(literal_strings) @@ -2196,7 +2196,7 @@ BOOST_AUTO_TEST_CASE(literal_strings) } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(invalid_integer_literal_fraction) @@ -2208,7 +2208,7 @@ BOOST_AUTO_TEST_CASE(invalid_integer_literal_fraction) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp) @@ -2220,7 +2220,7 @@ BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(memory_structs_with_mappings) @@ -2235,7 +2235,7 @@ BOOST_AUTO_TEST_CASE(memory_structs_with_mappings) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(string_bytes_conversion) @@ -2252,7 +2252,7 @@ BOOST_AUTO_TEST_CASE(string_bytes_conversion) function m() internal { string(b); } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(inheriting_from_library) @@ -2261,7 +2261,7 @@ BOOST_AUTO_TEST_CASE(inheriting_from_library) library Lib {} contract Test is Lib {} )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(inheriting_library) @@ -2270,7 +2270,7 @@ BOOST_AUTO_TEST_CASE(inheriting_library) contract Test {} library Lib is Test {} )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(library_having_variables) @@ -2278,7 +2278,7 @@ BOOST_AUTO_TEST_CASE(library_having_variables) char const* text = R"( library Lib { uint x; } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(valid_library) @@ -2286,7 +2286,7 @@ BOOST_AUTO_TEST_CASE(valid_library) char const* text = R"( library Lib { uint constant x = 9; } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(call_to_library_function) @@ -2302,7 +2302,7 @@ BOOST_AUTO_TEST_CASE(call_to_library_function) } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(creating_contract_within_the_contract) @@ -2312,7 +2312,7 @@ BOOST_AUTO_TEST_CASE(creating_contract_within_the_contract) function f() { var x = new Test(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(sourceCode) == Error::Type::TypeError); + BOOST_CHECK(expectError(sourceCode) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(array_out_of_bound_access) @@ -2326,7 +2326,7 @@ BOOST_AUTO_TEST_CASE(array_out_of_bound_access) } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(literal_string_to_storage_pointer) @@ -2336,7 +2336,7 @@ BOOST_AUTO_TEST_CASE(literal_string_to_storage_pointer) function f() { string x = "abc"; } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(non_initialized_references) @@ -2355,7 +2355,7 @@ BOOST_AUTO_TEST_CASE(non_initialized_references) } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text, true) == Error::Type::Warning); + BOOST_CHECK(expectError(text, true) == Error::Type::Warning); } BOOST_AUTO_TEST_CASE(sha3_with_large_integer_constant) @@ -2366,7 +2366,7 @@ BOOST_AUTO_TEST_CASE(sha3_with_large_integer_constant) function f() { sha3(2**500); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(cyclic_binary_dependency) @@ -2376,7 +2376,7 @@ BOOST_AUTO_TEST_CASE(cyclic_binary_dependency) contract B { function f() { new C(); } } contract C { function f() { new A(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(cyclic_binary_dependency_via_inheritance) @@ -2386,7 +2386,7 @@ BOOST_AUTO_TEST_CASE(cyclic_binary_dependency_via_inheritance) contract B { function f() { new C(); } } contract C { function f() { new A(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_fail) @@ -2394,7 +2394,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_fail) char const* text = R"( contract C { function f() { var (x,y); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fine) @@ -2414,7 +2414,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fine) } } )"; - BOOST_CHECK(successResolving(text)); + BOOST_CHECK(success(text)); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_1) @@ -2425,7 +2425,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_1) function f() { var (a, b, ) = one(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_2) { @@ -2435,7 +2435,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_2) function f() { var (a, , ) = one(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_3) @@ -2446,7 +2446,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_3) function f() { var (, , a) = one(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_4) @@ -2457,7 +2457,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_4) function f() { var (, a, b) = one(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_5) @@ -2468,7 +2468,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_5) function f() { var (,) = one(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6) @@ -2479,7 +2479,7 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration_wildcards_fail_6) function f() { var (a, b, c) = two(); } } )"; - BOOST_CHECK(parseAndAnalyseReturnErrorType(text) == Error::Type::TypeError); + BOOST_CHECK(expectError(text) == Error::Type::TypeError); } BOOST_AUTO_TEST_SUITE_END() |