aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SolidityParser.cpp')
-rw-r--r--SolidityParser.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/SolidityParser.cpp b/SolidityParser.cpp
index 88b86e63..2f5d06ef 100644
--- a/SolidityParser.cpp
+++ b/SolidityParser.cpp
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(empty_function)
{
char const* text = "contract test {\n"
" uint256 stateVar;\n"
- " function functionName(hash160 arg1, address addr) constant\n"
+ " function functionName(bytes20 arg1, address addr) constant\n"
" returns (int id)\n"
" { }\n"
"}\n";
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(single_function_param)
{
char const* text = "contract test {\n"
" uint256 stateVar;\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed.");
}
@@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(function_natspec_documentation)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" /// This is a test function\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(function_normal_comments)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" // We won't see this comment\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -164,13 +164,13 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" /// This is test function 1\n"
- " function functionName1(hash hashin) returns (hash hashout) {}\n"
+ " function functionName1(bytes32 input) returns (bytes32 out) {}\n"
" /// This is test function 2\n"
- " function functionName2(hash hashin) returns (hash hashout) {}\n"
+ " function functionName2(bytes32 input) returns (bytes32 out) {}\n"
" // nothing to see here\n"
- " function functionName3(hash hashin) returns (hash hashout) {}\n"
+ " function functionName3(bytes32 input) returns (bytes32 out) {}\n"
" /// This is test function 4\n"
- " function functionName4(hash hashin) returns (hash hashout) {}\n"
+ " function functionName4(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation)
" uint256 stateVar;\n"
" /// This is a test function\n"
" /// and it has 2 lines\n"
- " function functionName1(hash hashin) returns (hash hashout) {}\n"
+ " function functionName1(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -217,12 +217,12 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
- " string name = \"Solidity\";"
+ " mapping(address=>bytes32) d;\n"
+ " bytes7 name = \"Solidity\";"
" }\n"
" /// This is a test function\n"
" /// and it has 2 lines\n"
- " function fun(hash hashin) returns (hash hashout) {}\n"
+ " function fun(bytes32 input) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -246,8 +246,8 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
- " string name = \"Solidity\";"
+ " mapping(address=>bytes32) d;\n"
+ " bytes7 name = \"Solidity\";"
" }\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
@@ -269,8 +269,8 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
- " string name = \"Solidity\";"
+ " mapping(address=>bytes32) d;\n"
+ " bytes7 name = \"Solidity\";"
" }\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
@@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(struct_definition)
BOOST_AUTO_TEST_CASE(mapping)
{
char const* text = "contract test {\n"
- " mapping(address => string) names;\n"
+ " mapping(address => bytes32) names;\n"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
}
@@ -307,7 +307,7 @@ BOOST_AUTO_TEST_CASE(mapping_in_struct)
" struct test_struct {\n"
" address addr;\n"
" uint256 count;\n"
- " mapping(hash => test_struct) self_reference;\n"
+ " mapping(bytes32 => test_struct) self_reference;\n"
" }\n"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
@@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(mapping_to_mapping_in_struct)
char const* text = "contract test {\n"
" struct test_struct {\n"
" address addr;\n"
- " mapping (uint64 => mapping (hash => uint)) complex_mapping;\n"
+ " mapping (uint64 => mapping (bytes32 => uint)) complex_mapping;\n"
" }\n"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
@@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(variable_definition)
" function fun(uint256 a) {\n"
" var b;\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" customtype varname;\n"
" }\n"
"}\n";
@@ -343,8 +343,8 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization)
" function fun(uint256 a) {\n"
" var b = 2;\n"
" uint256 c = 0x87;\n"
- " mapping(address=>hash) d;\n"
- " string name = \"Solidity\";"
+ " mapping(address=>bytes32) d;\n"
+ " bytes7 name = \"Solidity\";"
" customtype varname;\n"
" }\n"
"}\n";
@@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_in_mapping)
char const* text = R"(
contract test {
function fun() {
- mapping(var=>hash) d;
+ mapping(var=>bytes32) d;
}
}
)";
@@ -662,7 +662,7 @@ BOOST_AUTO_TEST_CASE(event_arguments)
{
char const* text = R"(
contract c {
- event e(uint a, string32 s);
+ event e(uint a, bytes32 s);
})";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
}
@@ -671,7 +671,7 @@ BOOST_AUTO_TEST_CASE(event_arguments_indexed)
{
char const* text = R"(
contract c {
- event e(uint a, string32 indexed s, bool indexed b);
+ event e(uint a, bytes32 indexed s, bool indexed b);
})";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
}
@@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_events)
{
char const* text = R"(
contract c {
- event e(uint[10] a, string7[8] indexed b, c[3] x);
+ event e(uint[10] a, bytes7[8] indexed b, c[3] x);
})";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed");
}