mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding const attribute to ABI output
This commit is contained in:
parent
7795b2a892
commit
d7d40a13c2
@ -76,6 +76,7 @@ BOOST_AUTO_TEST_CASE(basic_test)
|
|||||||
char const* interface = R"([
|
char const* interface = R"([
|
||||||
{
|
{
|
||||||
"name": "f",
|
"name": "f",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "a",
|
"name": "a",
|
||||||
@ -114,6 +115,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
|
|||||||
char const* interface = R"([
|
char const* interface = R"([
|
||||||
{
|
{
|
||||||
"name": "f",
|
"name": "f",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "a",
|
"name": "a",
|
||||||
@ -129,6 +131,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "g",
|
"name": "g",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "b",
|
"name": "b",
|
||||||
@ -156,6 +159,7 @@ BOOST_AUTO_TEST_CASE(multiple_params)
|
|||||||
char const* interface = R"([
|
char const* interface = R"([
|
||||||
{
|
{
|
||||||
"name": "f",
|
"name": "f",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "a",
|
"name": "a",
|
||||||
@ -189,6 +193,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
|
|||||||
char const* interface = R"([
|
char const* interface = R"([
|
||||||
{
|
{
|
||||||
"name": "c",
|
"name": "c",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "b",
|
"name": "b",
|
||||||
@ -204,6 +209,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "f",
|
"name": "f",
|
||||||
|
"const": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"name": "a",
|
"name": "a",
|
||||||
@ -222,6 +228,53 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
|
|||||||
checkInterface(sourceCode, interface);
|
checkInterface(sourceCode, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(const_function)
|
||||||
|
{
|
||||||
|
char const* sourceCode = "contract test {\n"
|
||||||
|
" function foo(uint a, uint b) returns(uint d) { return a + b; }\n"
|
||||||
|
" function boo(uint32 a) const returns(uint b) { return a * 4; }\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
char const* interface = R"([
|
||||||
|
{
|
||||||
|
"name": "boo",
|
||||||
|
"const": true,
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint32"
|
||||||
|
}],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "foo",
|
||||||
|
"const": false,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])";
|
||||||
|
|
||||||
|
checkInterface(sourceCode, interface);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user