diff options
author | Gav Wood <g@ethdev.com> | 2015-03-11 02:48:41 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-03-11 02:48:41 +0800 |
commit | bf01fe780472ea53ce6854881cfab289011aeeb2 (patch) | |
tree | 81372a8f9824c5313f2a9b543470d0d921914000 | |
parent | 0b6b99cf165342a9d705a577e5a15cd9f78fee1c (diff) | |
parent | c260cb235b63d52e8b24fb7c06f2d07e5e1b3c88 (diff) | |
download | dexon-solidity-bf01fe780472ea53ce6854881cfab289011aeeb2.tar.gz dexon-solidity-bf01fe780472ea53ce6854881cfab289011aeeb2.tar.zst dexon-solidity-bf01fe780472ea53ce6854881cfab289011aeeb2.zip |
Merge pull request #1246 from debris/natspec_subtree
natspec.js subtree
-rw-r--r-- | natspec.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/natspec.cpp b/natspec.cpp index 8ba66041..cdcedca4 100644 --- a/natspec.cpp +++ b/natspec.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(natspec_eval_function_exists) // given NatspecExpressionEvaluator e; // when - string result = e.evalExpression("`typeof evaluateExpression`").toStdString(); + string result = e.evalExpression("`typeof natspec.evaluateExpression`").toStdString(); // then BOOST_CHECK_EQUAL(result, "function"); } @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(natspec_js_eval_input_params) // given char const* abi = R"([ { - "name": "f", + "name": "multiply", "constant": false, "type": "function", "inputs": [ @@ -94,7 +94,18 @@ BOOST_AUTO_TEST_CASE(natspec_js_eval_input_params) ] } ])"; - NatspecExpressionEvaluator e(abi, "'f'", "[4]"); + + char const* transaction = R"({ + "jsonrpc": "2.0", + "method": "eth_call", + "params": [{ + "to": "0x8521742d3f456bd237e312d6e30724960f72517a", + "data": "0xc6888fa10000000000000000000000000000000000000000000000000000000000000004" + }], + "id": 6 + })"; + + NatspecExpressionEvaluator e(abi, transaction , "multiply"); // when string result = e.evalExpression("Will multiply `a` by 7 and return `a * 7`.").toStdString(); // then @@ -108,7 +119,7 @@ BOOST_AUTO_TEST_CASE(natspec_js_eval_error) // when string result = e.evalExpression("`test(`").toStdString(); // then - BOOST_CHECK_EQUAL(result, "`test(`"); + BOOST_CHECK_EQUAL(result, "Natspec evaluation failed, wrong input params"); } BOOST_AUTO_TEST_SUITE_END() |