mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Changes in Solidity Tests to use the new bytesXX type
This commit is contained in:
parent
125a1bb670
commit
5e42f54f96
@ -339,10 +339,10 @@ BOOST_AUTO_TEST_CASE(inherited)
|
||||
char const* sourceCode =
|
||||
" contract Base { \n"
|
||||
" function baseFunction(uint p) returns (uint i) { return p; } \n"
|
||||
" event baseEvent(string32 indexed evtArgBase); \n"
|
||||
" event baseEvent(bytes32 indexed evtArgBase); \n"
|
||||
" } \n"
|
||||
" contract Derived is Base { \n"
|
||||
" function derivedFunction(string32 p) returns (string32 i) { return p; } \n"
|
||||
" function derivedFunction(bytes32 p) returns (bytes32 i) { return p; } \n"
|
||||
" event derivedEvent(uint indexed evtArgDerived); \n"
|
||||
" }";
|
||||
|
||||
@ -369,12 +369,12 @@ BOOST_AUTO_TEST_CASE(inherited)
|
||||
"inputs":
|
||||
[{
|
||||
"name": "p",
|
||||
"type": "string32"
|
||||
"type": "bytes32"
|
||||
}],
|
||||
"outputs":
|
||||
[{
|
||||
"name": "i",
|
||||
"type": "string32"
|
||||
"type": "bytes32"
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -394,7 +394,7 @@ BOOST_AUTO_TEST_CASE(inherited)
|
||||
[{
|
||||
"indexed": true,
|
||||
"name": "evtArgBase",
|
||||
"type": "string32"
|
||||
"type": "bytes32"
|
||||
}]
|
||||
}])";
|
||||
|
||||
|
@ -84,10 +84,10 @@ BOOST_AUTO_TEST_CASE(single_function)
|
||||
BOOST_AUTO_TEST_CASE(single_constant_function)
|
||||
{
|
||||
ContractDefinition const& contract = checkInterface(
|
||||
"contract test { function f(uint a) constant returns(hash8 x) { 1==2; } }");
|
||||
"contract test { function f(uint a) constant returns(bytes1 x) { 1==2; } }");
|
||||
BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()),
|
||||
"function f(uint256 a)constant returns(hash8 x){}");
|
||||
"function f(uint256 a)constant returns(bytes1 x){}");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiple_functions)
|
||||
@ -128,15 +128,15 @@ BOOST_AUTO_TEST_CASE(inheritance)
|
||||
char const* sourceCode =
|
||||
" contract Base { \n"
|
||||
" function baseFunction(uint p) returns (uint i) { return p; } \n"
|
||||
" event baseEvent(string32 indexed evtArgBase); \n"
|
||||
" event baseEvent(bytes32 indexed evtArgBase); \n"
|
||||
" } \n"
|
||||
" contract Derived is Base { \n"
|
||||
" function derivedFunction(string32 p) returns (string32 i) { return p; } \n"
|
||||
" function derivedFunction(bytes32 p) returns (bytes32 i) { return p; } \n"
|
||||
" event derivedEvent(uint indexed evtArgDerived); \n"
|
||||
" }";
|
||||
ContractDefinition const& contract = checkInterface(sourceCode);
|
||||
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
|
||||
"function derivedFunction(string32 p)returns(string32 i){}"});
|
||||
"function derivedFunction(bytes32 p)returns(bytes32 i){}"});
|
||||
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
|
||||
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
|
||||
getSourcePart(*contract.getDefinedFunctions().at(1))}));
|
||||
|
Loading…
Reference in New Issue
Block a user