renamed externalTypes to externalSignature

This commit is contained in:
Liana Husikyan 2015-03-24 11:11:27 +01:00
parent 7e73fd3f45
commit 54bb1abcfa
2 changed files with 23 additions and 5 deletions

View File

@ -359,7 +359,7 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
auto functions = contract->getDefinedFunctions();
BOOST_CHECK_EQUAL("foo(uint256,uint64,bool)", functions[0]->externalTypes());
BOOST_CHECK_EQUAL("foo(uint256,uint64,bool)", functions[0]->externalSignature());
}
}
@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature_type_aliases)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
auto functions = contract->getDefinedFunctions();
BOOST_CHECK_EQUAL("boo(uint256,bytes32,address)", functions[0]->externalTypes());
BOOST_CHECK_EQUAL("boo(uint256,bytes32,address)", functions[0]->externalSignature());
}
}
@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(function_external_types)
ASTPointer<SourceUnit> sourceUnit;
char const* text = R"(
contract Test {
function boo(uint arg2, bool arg3, bytes8 arg4) returns (uint ret) {
function boo(uint arg2, bool arg3, bytes8 arg4, bool[2] pairs) public returns (uint ret) {
ret = 5;
}
})";
@ -394,10 +394,28 @@ BOOST_AUTO_TEST_CASE(function_external_types)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
auto functions = contract->getDefinedFunctions();
BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8)", functions[0]->externalTypes());
BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8)", functions[0]->externalSignature());
}
}
//BOOST_AUTO_TEST_CASE(function_external_types_throw)
//{
// ASTPointer<SourceUnit> sourceUnit;
// char const* text = R"(
// contract ArrayContract {
// bool[2][] m_pairsOfFlags;
// function setAllFlagPairs(bool[2][] newPairs) {
// // assignment to array replaces the complete array
// m_pairsOfFlags = newPairs;
// }
// })";
// ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed");
// for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
// if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
// {
// auto functions = contract->getDefinedFunctions();
// BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8)", functions[0]->externalSigniture());
// }
//todo should check arrays and contract. also event
//BOOST_AUTO_TEST_CASE(function_external_types_throw)
//{
@ -666,6 +684,7 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors)
"mapping(uint=>bytes4) public map;\n"
"mapping(uint=>mapping(uint=>bytes4)) public multiple_map;\n"
"}\n";
ASTPointer<SourceUnit> source;
ContractDefinition const* contract;
ETH_TEST_CHECK_NO_THROW(source = parseTextAndResolveNames(text), "Parsing and Resolving names failed");

View File

@ -86,7 +86,6 @@ BOOST_AUTO_TEST_CASE(storage_layout_arrays)
BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(32), 9).getStorageSize() == 9);
}
BOOST_AUTO_TEST_SUITE_END()
}