summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/commands/trex_rpc_cmd_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc-server/commands/trex_rpc_cmd_test.cpp')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_test.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_test.cpp b/src/rpc-server/commands/trex_rpc_cmd_test.cpp
index e67de286..473cbb70 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_test.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_test.cpp
@@ -36,10 +36,9 @@ TrexRpcCmdTestAdd::_run(const Json::Value &params, Json::Value &result) {
const Json::Value &y = params["y"];
check_param_count(params, 2, result);
- check_field_type(params, "x", FIELD_TYPE_INT, result);
- check_field_type(params, "y", FIELD_TYPE_INT, result);
- result["result"] = x.asInt() + y.asInt();
+ result["result"] = parse_int(params, "x", result) + parse_int(params, "y", result);
+
return (TREX_RPC_CMD_OK);
}
@@ -55,10 +54,9 @@ TrexRpcCmdTestSub::_run(const Json::Value &params, Json::Value &result) {
const Json::Value &y = params["y"];
check_param_count(params, 2, result);
- check_field_type(params, "x", TrexRpcCommand::FIELD_TYPE_INT, result);
- check_field_type(params, "y", TrexRpcCommand::FIELD_TYPE_INT, result);
- result["result"] = x.asInt() - y.asInt();
+ result["result"] = parse_int(params, "x", result) - parse_int(params, "y", result);
+
return (TREX_RPC_CMD_OK);
}