|
|
@ -76,6 +76,7 @@ BOOST_AUTO_TEST_CASE(basic_test) |
|
|
|
char const* interface = R"([ |
|
|
|
{ |
|
|
|
"name": "f", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "a", |
|
|
@ -114,6 +115,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods) |
|
|
|
char const* interface = R"([ |
|
|
|
{ |
|
|
|
"name": "f", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "a", |
|
|
@ -129,6 +131,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods) |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "g", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "b", |
|
|
@ -156,6 +159,7 @@ BOOST_AUTO_TEST_CASE(multiple_params) |
|
|
|
char const* interface = R"([ |
|
|
|
{ |
|
|
|
"name": "f", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "a", |
|
|
@ -189,6 +193,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order) |
|
|
|
char const* interface = R"([ |
|
|
|
{ |
|
|
|
"name": "c", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "b", |
|
|
@ -204,6 +209,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order) |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "f", |
|
|
|
"const": false, |
|
|
|
"inputs": [ |
|
|
|
{ |
|
|
|
"name": "a", |
|
|
@ -222,6 +228,53 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order) |
|
|
|
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() |
|
|
|
|
|
|
|
} |
|
|
|