From 3801410bdd5d2b869be00fb734dc464c5d9aff87 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Sat, 4 Nov 2023 10:12:33 +0000 Subject: [PATCH] Fix RPCCall test --- src/test/jtx/Env.h | 2 +- src/test/rpc/RPCCall_test.cpp | 2573 +++++++++++++++++++-------------- 2 files changed, 1451 insertions(+), 1124 deletions(-) diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index e4c84cc1d01..383c116abfc 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -782,7 +782,7 @@ void forAllApiVersions(VersionedTestCallable auto... testCallable) { for (auto testVersion = RPC::apiMinimumSupportedVersion; - testVersion <= RPC::apiBetaVersion; + testVersion <= RPC::apiMaximumValidVersion; ++testVersion) { (..., testCallable(testVersion)); diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 00482281aa4..e611b6cfad6 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -24,6 +24,8 @@ #include #include + +#include #include #include @@ -42,14 +44,14 @@ struct RPCCallTestData Exception const throwsWhat; // Expected JSON response. - char const* const exp; + std::vector exp; RPCCallTestData( char const* description_, int line_, std::initializer_list const& args_, Exception throwsWhat_, - char const* exp_) + std::initializer_list exp_) : description(description_) , line(line_) , args(args_) @@ -74,63 +76,67 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_channels", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_channels: account and ledger hash.", __LINE__, {"account_channels", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "rD5MbavGfiSC5m7mkxy1FANuT7s3HxqpoF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rD5MbavGfiSC5m7mkxy1FANuT7s3HxqpoF" } ] - })"}, + })"}}, {"account_channels: account and ledger index.", __LINE__, {"account_channels", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "r9emE59aTWb85t64dAebKrxYMBTpzK5yR7"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "r9emE59aTWb85t64dAebKrxYMBTpzK5yR7" } ] - })"}, + })"}}, {"account_channels: two accounts.", __LINE__, {"account_channels", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_channels: two accounts and ledger hash.", __LINE__, {"account_channels", @@ -138,17 +144,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } ] - })"}, + })"}}, {"account_channels: two accounts and ledger index.", __LINE__, {"account_channels", @@ -156,24 +163,26 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "90210"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "destination_account" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 90210 } ] - })"}, + })"}}, {"account_channels: too few arguments.", __LINE__, { "account_channels", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { @@ -182,7 +191,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_channels: too many arguments.", __LINE__, {"account_channels", @@ -191,7 +200,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "current", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { @@ -200,7 +210,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_channels: invalid accountID.", __LINE__, { @@ -208,7 +218,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "", // Note: very few values are detected as bad! }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_channels", "params" : [ { @@ -217,7 +228,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })"}, + })"}}, // account_currencies // ---------------------------------------------------------- @@ -225,77 +236,83 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_currencies", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_currencies: minimal 2.", __LINE__, {"account_currencies", "racb4o3DrdYxuCfyVa6vsLb7vgju9RFbBr"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "racb4o3DrdYxuCfyVa6vsLb7vgju9RFbBr" } ] - })"}, + })"}}, {"account_currencies: ledger index.", __LINE__, {"account_currencies", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "42"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 42 } ] - })"}, + })"}}, {"account_currencies: validated ledger.", __LINE__, {"account_currencies", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } ] - })"}, + })"}}, {"account_currencies: current ledger.", __LINE__, {"account_currencies", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current" } ] - })"}, + })"}}, {"account_currencies: too few arguments.", __LINE__, { "account_currencies", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { @@ -304,7 +321,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_currencies: too many arguments.", __LINE__, {"account_currencies", @@ -313,7 +330,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "spare1", "spare2"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { @@ -322,30 +340,32 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_currencies: invalid second argument.", __LINE__, {"account_currencies", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "yup"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_currencies", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })"}, - { - "account_currencies: invalid accountID.", - __LINE__, - { - "account_currencies", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_currencies: invalid accountID.", + __LINE__, + { + "account_currencies", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_currencies", "params" : [ { @@ -354,8 +374,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, + })"}}, // account_info // ---------------------------------------------------------------- @@ -363,80 +382,86 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_info: with numeric ledger index.", __LINE__, {"account_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "77777"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } ] - })"}, + })"}}, {"account_info: with text ledger index.", __LINE__, {"account_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "closed"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } ] - })"}, + })"}}, {"account_info: with ledger hash.", __LINE__, {"account_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } ] - })"}, + })"}}, {"account_info: with ledger index.", __LINE__, {"account_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] - })"}, + })"}}, {"account_info: too few arguments.", __LINE__, { "account_info", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { @@ -445,7 +470,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_info: too many arguments.", __LINE__, {"account_info", @@ -454,7 +479,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra1", "extra2"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_info", "params" : [ { @@ -463,16 +489,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "account_info: invalid accountID.", - __LINE__, - { - "account_info", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_info: invalid accountID.", + __LINE__, + { + "account_info", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_info", "params" : [ { @@ -481,8 +508,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, + })"}}, // account_lines // --------------------------------------------------------------- @@ -490,31 +516,33 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_lines", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] - })"}, + })"}}, {"account_lines: peer.", __LINE__, {"account_lines", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_lines: peer and numeric ledger index.", __LINE__, {"account_lines", @@ -522,17 +550,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "888888888"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 888888888, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_lines: peer and text ledger index.", __LINE__, {"account_lines", @@ -540,17 +569,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "closed"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_lines: peer and ledger hash.", __LINE__, {"account_lines", @@ -558,24 +588,26 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000", "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_lines: too few arguments.", __LINE__, { "account_lines", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { @@ -584,7 +616,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {// Note: I believe this _ought_ to be detected as too many arguments. "account_lines: four arguments.", __LINE__, @@ -594,17 +626,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "12345678", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {// Note: I believe this _ought_ to be detected as too many arguments. "account_lines: five arguments.", __LINE__, @@ -615,17 +648,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "current", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 12345678, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })"}, + })"}}, {"account_lines: too many arguments.", __LINE__, {"account_lines", @@ -636,7 +670,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_lines", "params" : [ { @@ -645,16 +680,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "account_lines: first invalid accountID.", - __LINE__, - { - "account_lines", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_lines: first invalid accountID.", + __LINE__, + { + "account_lines", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_lines", "params" : [ { @@ -663,47 +699,46 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, - { - "account_lines: second invalid accountID.", - __LINE__, - { - "account_lines", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "" // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_lines: second invalid accountID.", + __LINE__, + { + "account_lines", + "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "" // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })", - }, - { - "account_lines: invalid ledger selector.", - __LINE__, - {"account_lines", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", - "not_a_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_lines: invalid ledger selector.", + __LINE__, + {"account_lines", + "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", + "not_a_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_lines", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0, "peer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" } ] - })", - }, + })"}}, // account_objects // ------------------------------------------------------------- @@ -711,80 +746,86 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_objects: with numeric ledger index.", __LINE__, {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "77777"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 77777 } ] - })"}, + })"}}, {"account_objects: with text ledger index.", __LINE__, {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "closed"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "closed" } ] - })"}, + })"}}, {"account_objects: with ledger hash.", __LINE__, {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } ] - })"}, + })"}}, {"account_objects: with ledger index.", __LINE__, {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } ] - })"}, + })"}}, {"account_objects: too few arguments.", __LINE__, { "account_objects", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { @@ -793,7 +834,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {// Note: I believe this _ought_ to be detected as too many arguments. "account_objects: four arguments.", __LINE__, @@ -805,15 +846,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra2", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {// Note: I believe this _ought_ to be detected as too many arguments. "account_objects: five arguments.", __LINE__, @@ -826,15 +868,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra3", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_objects: too many arguments.", __LINE__, { @@ -847,7 +890,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra4", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_objects", "params" : [ { @@ -856,16 +900,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "account_objects: invalid accountID.", - __LINE__, - { - "account_objects", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_objects: invalid accountID.", + __LINE__, + { + "account_objects", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_objects", "params" : [ { @@ -874,44 +919,43 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "account_objects: invalid ledger selection 1.", - __LINE__, - {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "account_objects: invalid ledger selection 1.", + __LINE__, + {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "account_objects: invalid ledger selection 2.", - __LINE__, - {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "account_objects: invalid ledger selection 2.", + __LINE__, + {"account_objects", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_objects", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, + })"}}, // account_offers // -------------------------------------------------------------- @@ -919,80 +963,86 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_offers: with numeric ledger index.", __LINE__, {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "987654321"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } ] - })"}, + })"}}, {"account_offers: with text ledger index.", __LINE__, {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } ] - })"}, + })"}}, {"account_offers: with ledger hash.", __LINE__, {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } ] - })"}, + })"}}, {"account_offers: with ledger index.", __LINE__, {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } ] - })"}, + })"}}, {"account_offers: too few arguments.", __LINE__, { "account_offers", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { @@ -1001,7 +1051,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {// Note: I believe this _ought_ to be detected as too many arguments. "account_offers: four arguments.", __LINE__, @@ -1010,15 +1060,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "current", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"account_offers: too many arguments.", __LINE__, { @@ -1030,7 +1081,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra3", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_offers", "params" : [ { @@ -1039,16 +1091,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "account_offers: invalid accountID.", - __LINE__, - { - "account_offers", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_offers: invalid accountID.", + __LINE__, + { + "account_offers", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_offers", "params" : [ { @@ -1057,44 +1110,43 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "account_offers: invalid ledger selection 1.", - __LINE__, - {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "account_offers: invalid ledger selection 1.", + __LINE__, + {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "account_offers: invalid ledger selection 2.", - __LINE__, - {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "account_offers: invalid ledger selection 2.", + __LINE__, + {"account_offers", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, + })"}}, // account_tx // ------------------------------------------------------------------ @@ -1102,29 +1154,31 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] - })"}, + })"}}, {"account_tx: ledger_index .", __LINE__, {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "444"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 444 } ] - })"}, + })"}}, {"account_tx: ledger_index plus trailing params.", __LINE__, {"account_tx", @@ -1134,11 +1188,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "binary", "count"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "binary" : true, @@ -1146,22 +1201,23 @@ static RPCCallTestData const rpcCallTestArray[] = { "ledger_index" : 707 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max.", __LINE__, {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-1", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : -1 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max plus trailing params.", __LINE__, {"account_tx", @@ -1172,11 +1228,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "count", "descending"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1185,23 +1242,24 @@ static RPCCallTestData const rpcCallTestArray[] = { "ledger_index_min" : -1 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max plus limit.", __LINE__, {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "247", "-1", "300"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : -1, "ledger_index_min" : 247, "limit" : 300 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max, limit, trailing args.", __LINE__, {"account_tx", @@ -1213,11 +1271,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "descending", "binary"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "binary" : true, "count" : true, @@ -1227,7 +1286,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "limit" : 300 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max plus limit and offset.", __LINE__, {"account_tx", @@ -1237,11 +1296,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "67", "45"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index_max" : 590, "ledger_index_min" : 589, @@ -1249,7 +1309,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "offset" : 45 } ] - })"}, + })"}}, {"account_tx: ledger_index_min and _max, limit, offset, trailing.", __LINE__, {"account_tx", @@ -1261,11 +1321,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "descending", "count"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "count" : true, "descending" : true, @@ -1275,14 +1336,15 @@ static RPCCallTestData const rpcCallTestArray[] = { "offset" : 45 } ] - })"}, + })"}}, {"account_tx: too few arguments.", __LINE__, { "account_tx", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { @@ -1291,7 +1353,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"account_tx: too many arguments.", __LINE__, {"account_tx", @@ -1305,7 +1367,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "count", "binary"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "account_tx", "params" : [ { @@ -1314,13 +1377,14 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "account_tx: invalid accountID.", - __LINE__, - {"account_tx", "rHb9CJAWyB4rj9!VRWn96DkukG4bwdtyTh"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "account_tx: invalid accountID.", + __LINE__, + {"account_tx", "rHb9CJAWyB4rj9!VRWn96DkukG4bwdtyTh"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_tx", "params" : [ { @@ -1329,32 +1393,31 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, - { - // Note: not currently detected as bad input. - "account_tx: invalid ledger.", - __LINE__, - {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-478.7"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: not currently detected as bad input. + "account_tx: invalid ledger.", + __LINE__, + {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-478.7"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, - { - "account_tx: max less than min.", - __LINE__, - {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "580", "579"}, - RPCCallTestData::no_exception, - RPC::apiMaximumSupportedVersion == 1 ? - R"({ + })"}}, + {// + "account_tx: max less than min.", + __LINE__, + {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "580", "579"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "account_tx", "params" : [ { @@ -1363,9 +1426,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Ledger indexes invalid." } ] - })" - : - R"({ + })", + R"({ "method" : "account_tx", "params" : [ { @@ -1374,50 +1436,46 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Not synced to the network." } ] - })", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "account_tx: non-integer min.", - __LINE__, - {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "Binary", "-1"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "account_tx: non-integer max.", - __LINE__, - {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-1", "counts"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "account_tx: non-integer offset.", - __LINE__, - {"account_tx", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "-1", - "-1", - "decending"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "account_tx: non-integer limit.", - __LINE__, - {"account_tx", - "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "-1", - "-1", - "300", - "false"}, - RPCCallTestData::bad_cast, - R"()", - }, - {// Note: this really shouldn't throw, but does at the moment. + })"}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "account_tx: non-integer min.", + __LINE__, + {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "Binary", "-1"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "account_tx: non-integer max.", + __LINE__, + {"account_tx", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "-1", "counts"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "account_tx: non-integer offset.", + __LINE__, + {"account_tx", + "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "-1", + "-1", + "decending"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "account_tx: non-integer limit.", + __LINE__, + {"account_tx", + "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", + "-1", + "-1", + "300", + "false"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. "account_tx: RIPD-1570.", __LINE__, {"account_tx", @@ -1429,7 +1487,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "false", "false"}, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // book_offers // ----------------------------------------------------------------- @@ -1441,11 +1499,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "EUR", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "taker_gets" : { "currency" : "EUR" }, @@ -1454,7 +1513,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: minimal with currency/issuer", __LINE__, { @@ -1463,11 +1522,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "taker_gets" : { "currency" : "EUR", "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA" @@ -1478,18 +1538,19 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {// Note: documentation suggests that "issuer" is the wrong type. // Should it be "taker" instead? "book_offers: add issuer.", __LINE__, {"book_offers", "USD", "EUR", "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "taker_gets" : { "currency" : "EUR" @@ -1499,7 +1560,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: add issuer and numeric ledger index.", __LINE__, {"book_offers", @@ -1508,11 +1569,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "666"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 666, "taker_gets" : { @@ -1524,7 +1586,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: add issuer and text ledger index.", __LINE__, {"book_offers", @@ -1533,11 +1595,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : "current", "taker_gets" : { @@ -1549,7 +1612,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: add issuer and ledger hash.", __LINE__, {"book_offers", @@ -1558,11 +1621,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "taker_gets" : { @@ -1575,7 +1639,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: issuer, ledger hash, and limit.", __LINE__, { @@ -1589,11 +1653,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "200", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1608,7 +1673,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {// Note: parser supports "marker", but the docs don't cover it. "book_offers: issuer, ledger hash, limit, and marker.", __LINE__, @@ -1621,11 +1686,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "200", "MyMarker"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "limit" : 200, @@ -1641,14 +1707,15 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: too few arguments.", __LINE__, { "book_offers", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { @@ -1657,7 +1724,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"book_offers: too many arguments.", __LINE__, {"book_offers", @@ -1670,7 +1737,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "MyMarker", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { @@ -1679,7 +1747,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"book_offers: taker pays no currency.", __LINE__, @@ -1689,7 +1757,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "EUR/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { @@ -1698,7 +1767,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid currency/issuer '/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'" } ] - })"}, + })"}}, {"book_offers: taker gets no currency.", __LINE__, { @@ -1707,7 +1776,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { @@ -1716,16 +1786,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid currency/issuer '/rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA'" } ] - })"}, + })"}}, {"book_offers: invalid issuer.", __LINE__, {"book_offers", "USD", "EUR", "not_a_valid_issuer"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "not_a_valid_issuer", "taker_gets" : { "currency" : "EUR" @@ -1735,7 +1806,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"book_offers: invalid text ledger index.", __LINE__, {"book_offers", @@ -1744,11 +1815,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "not_a_ledger"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "book_offers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "issuer" : "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "ledger_index" : 0, "taker_gets" : { @@ -1760,7 +1832,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {// Note: this really shouldn't throw, but does at the moment. "book_offers: non-numeric limit.", __LINE__, @@ -1775,7 +1847,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "not_a_number", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // can_delete // ------------------------------------------------------------------ @@ -1785,14 +1857,15 @@ static RPCCallTestData const rpcCallTestArray[] = { "can_delete", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"can_delete: ledger index.", __LINE__, { @@ -1800,15 +1873,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "4294967295", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : 4294967295 } ] - })"}, + })"}}, {"can_delete: ledger hash.", __LINE__, { @@ -1816,15 +1890,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210" } ] - })"}, + })"}}, {"can_delete: always.", __LINE__, { @@ -1832,15 +1907,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "always", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "always" } ] - })"}, + })"}}, {"can_delete: never.", __LINE__, { @@ -1848,15 +1924,16 @@ static RPCCallTestData const rpcCallTestArray[] = { "never", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "never" } ] - })"}, + })"}}, {"can_delete: now.", __LINE__, { @@ -1864,20 +1941,22 @@ static RPCCallTestData const rpcCallTestArray[] = { "now", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "now" } ] - })"}, + })"}}, {"can_delete: too many arguments.", __LINE__, {"can_delete", "always", "never"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { @@ -1886,20 +1965,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"can_delete: invalid argument.", __LINE__, {"can_delete", "invalid"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "can_delete", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "can_delete" : "invalid" } ] - })"}, + })"}}, {// Note: this should return an error but not throw. "can_delete: ledger index > 32 bits.", __LINE__, @@ -1908,7 +1988,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "4294967296", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {// Note: this really shouldn't throw since it's a legitimate ledger hash. "can_delete: ledger hash with no alphas.", __LINE__, @@ -1917,7 +1997,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456701234567012345670123456701234567012345670123456701234567", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // channel_authorize // ----------------------------------------------------------- @@ -1928,17 +2008,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "18446744073709551615"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "secret" : "secret_can_be_anything" } ] - })"}, + })"}}, {"channel_authorize: too few arguments.", __LINE__, { @@ -1947,7 +2028,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -1956,7 +2038,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"channel_authorize: too many arguments.", __LINE__, {"channel_authorize", @@ -1966,7 +2048,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "whatever", "whenever"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -1975,7 +2058,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"channel_authorize: bad key type.", __LINE__, {"channel_authorize", @@ -1984,7 +2067,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "2000", "whatever"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -1993,7 +2077,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Bad key type." } ] - })"}, + })"}}, {"channel_authorize: channel_id too short.", __LINE__, {"channel_authorize", @@ -2001,7 +2085,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "2000"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -2010,7 +2095,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel is malformed." } ] - })"}, + })"}}, {"channel_authorize: channel_id too long.", __LINE__, {"channel_authorize", @@ -2018,7 +2103,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "10123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "2000"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -2027,7 +2113,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel is malformed." } ] - })"}, + })"}}, {"channel_authorize: channel_id not hex.", __LINE__, {"channel_authorize", @@ -2035,7 +2121,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEZ", "2000"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -2044,7 +2131,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel is malformed." } ] - })"}, + })"}}, {"channel_authorize: negative amount.", __LINE__, {"channel_authorize", @@ -2052,7 +2139,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -2061,7 +2149,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel amount is malformed." } ] - })"}, + })"}}, {"channel_authorize: amount > 64 bits.", __LINE__, {"channel_authorize", @@ -2069,7 +2157,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "18446744073709551616"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_authorize", "params" : [ { @@ -2078,7 +2167,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel amount is malformed." } ] - })"}, + })"}}, // channel_verify // -------------------------------------------------------------- @@ -2090,18 +2179,19 @@ static RPCCallTestData const rpcCallTestArray[] = { "0", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "0", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", "signature" : "DEADBEEF" } ] - })"}, + })"}}, {"channel_verify: public key hex.", __LINE__, {"channel_verify", @@ -2110,25 +2200,27 @@ static RPCCallTestData const rpcCallTestArray[] = { "18446744073709551615", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "18446744073709551615", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "021D93E21C44160A1B3B66DA1F37B86BE39FFEA3FC4B95FAA2063F82EE823599F6", "signature" : "DEADBEEF" } ] - })"}, + })"}}, {"channel_verify: too few arguments.", __LINE__, {"channel_verify", "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2137,7 +2229,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"channel_verify: too many arguments.", __LINE__, {"channel_verify", @@ -2147,7 +2239,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "DEADBEEF", "Whatever"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2156,7 +2249,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"channel_verify: malformed public key.", __LINE__, {"channel_verify", @@ -2165,7 +2258,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "2000", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2174,7 +2268,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Public key is malformed." } ] - })"}, + })"}}, {"channel_verify: malformed hex public key.", __LINE__, {"channel_verify", @@ -2183,7 +2277,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "2000", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2192,7 +2287,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Public key is malformed." } ] - })"}, + })"}}, {"channel_verify: invalid channel id.", __LINE__, {"channel_verify", @@ -2201,7 +2296,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "2000", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2210,7 +2306,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel is malformed." } ] - })"}, + })"}}, {"channel_verify: short channel id.", __LINE__, {"channel_verify", @@ -2219,7 +2315,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "2000", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2228,7 +2325,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel is malformed." } ] - })"}, + })"}}, {"channel_verify: amount too small.", __LINE__, {"channel_verify", @@ -2237,7 +2334,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "-1", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2246,7 +2344,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel amount is malformed." } ] - })"}, + })"}}, {"channel_verify: amount too large.", __LINE__, {"channel_verify", @@ -2255,7 +2353,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "18446744073709551616", "DEADBEEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { @@ -2264,7 +2363,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Payment channel amount is malformed." } ] - })"}, + })"}}, {"channel_verify: non-hex signature.", __LINE__, {"channel_verify", @@ -2273,18 +2372,19 @@ static RPCCallTestData const rpcCallTestArray[] = { "40000000", "ThisIsNotHexadecimal"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "channel_verify", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "amount" : "40000000", "channel_id" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "public_key" : "aB4BXXLuPu8DpVuyq1DBiu3SrPdtK9AYZisKhu8mvkoiUD8J9Gov", "signature" : "ThisIsNotHexadecimal" } ] - })"}, + })"}}, // connect // --------------------------------------------------------------------- @@ -2295,36 +2395,39 @@ static RPCCallTestData const rpcCallTestArray[] = { "ThereIsNoCheckingOnTheIPFormat", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "connect", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat" } ] - })"}, + })"}}, {"connect: ip and port.", __LINE__, {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "connect", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ip" : "ThereIsNoCheckingOnTheIPFormat", "port" : 6561 } ] - })"}, + })"}}, {"connect: too few arguments.", __LINE__, { "connect", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "connect", "params" : [ { @@ -2333,12 +2436,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"connect: too many arguments.", __LINE__, {"connect", "ThereIsNoCheckingOnTheIPFormat", "6561", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "connect", "params" : [ { @@ -2347,7 +2451,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {// Note: this should return an error but not throw. "connect: port too small.", __LINE__, @@ -2357,7 +2461,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "-1", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {// Note: this should return an error but not throw. "connect: port too large.", __LINE__, @@ -2367,7 +2471,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "4294967296", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // consensus_info // -------------------------------------------------------------- @@ -2377,19 +2481,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "consensus_info", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "consensus_info", "params" : [ { - "api_version" : %MAX_API_VER% + "api_version" : %API_VER% } ] - })"}, + })"}}, {"consensus_info: too many arguments.", __LINE__, {"consensus_info", "whatever"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "consensus_info", "params" : [ { @@ -2398,7 +2504,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // deposit_authorized // ---------------------------------------------------------- @@ -2410,16 +2516,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "destination_account_NotValidated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "source_account" : "source_account_NotValidated" } ] - })"}, + })"}}, {"deposit_authorized: with text ledger index.", __LINE__, {"deposit_authorized", @@ -2427,17 +2534,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "destination_account_NotValidated", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : "validated", "source_account" : "source_account_NotValidated" } ] - })"}, + })"}}, {"deposit_authorized: with ledger index.", __LINE__, {"deposit_authorized", @@ -2445,17 +2553,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "destination_account_NotValidated", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 4294967295, "source_account" : "source_account_NotValidated" } ] - })"}, + })"}}, {"deposit_authorized: with ledger hash.", __LINE__, {"deposit_authorized", @@ -2463,17 +2572,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "destination_account_NotValidated", "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "source_account" : "source_account_NotValidated" } ] - })"}, + })"}}, {"deposit_authorized: too few arguments.", __LINE__, { @@ -2481,7 +2591,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "source_account_NotValidated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { @@ -2490,7 +2601,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"deposit_authorized: too many arguments.", __LINE__, {"deposit_authorized", @@ -2499,7 +2610,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { @@ -2508,7 +2620,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"deposit_authorized: invalid ledger selection.", __LINE__, { @@ -2518,17 +2630,18 @@ static RPCCallTestData const rpcCallTestArray[] = { "NotALedger", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "deposit_authorized", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "destination_account" : "destination_account_NotValidated", "ledger_index" : 0, "source_account" : "source_account_NotValidated" } ] - })"}, + })"}}, // download_shard // -------------------------------------------------------------- @@ -2540,11 +2653,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2553,7 +2667,7 @@ static RPCCallTestData const rpcCallTestArray[] = { ] } ] - })"}, + })"}}, {"download_shard:", __LINE__, { @@ -2562,11 +2676,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2575,7 +2690,7 @@ static RPCCallTestData const rpcCallTestArray[] = { ] } ] - })"}, + })"}}, {"download_shard: many shards.", __LINE__, { @@ -2590,11 +2705,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated3", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 200000000, @@ -2615,7 +2731,7 @@ static RPCCallTestData const rpcCallTestArray[] = { ] } ] - })"}, + })"}}, {"download_shard: many shards.", __LINE__, { @@ -2632,11 +2748,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated4", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 2000000, @@ -2661,12 +2778,13 @@ static RPCCallTestData const rpcCallTestArray[] = { ] } ] - })"}, + })"}}, {"download_shard: too few arguments.", __LINE__, {"download_shard", "20"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { @@ -2675,13 +2793,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {// Note: this should return an error but not throw. "download_shard: novalidate too few arguments.", __LINE__, {"download_shard", "novalidate", "20"}, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {"download_shard: novalidate at end.", __LINE__, { @@ -2691,11 +2809,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "novalidate", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "shards" : [ { "index" : 20, @@ -2704,7 +2823,7 @@ static RPCCallTestData const rpcCallTestArray[] = { ] } ] - })"}, + })"}}, {"download_shard: novalidate in middle.", __LINE__, { @@ -2716,7 +2835,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated200", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "download_shard", "params" : [ { @@ -2725,7 +2845,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {// Note: this should return an error but not throw. "download_shard: arguments swapped.", __LINE__, @@ -2735,7 +2855,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "20", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {"download_shard: index too small.", __LINE__, { @@ -2744,7 +2864,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {"download_shard: index too big.", __LINE__, { @@ -2753,7 +2873,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "url_NotValidated", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // feature // --------------------------------------------------------------------- @@ -2763,27 +2883,29 @@ static RPCCallTestData const rpcCallTestArray[] = { "feature", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"feature: with name.", __LINE__, {"feature", "featureNameOrHexIsNotValidated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "featureNameOrHexIsNotValidated" } ] - })"}, + })"}}, {"feature: accept.", __LINE__, {"feature", @@ -2791,35 +2913,38 @@ static RPCCallTestData const rpcCallTestArray[] = { "76543210", "accept"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210FEDCBA9876543210", "vetoed" : false } ] - })"}, + })"}}, {"feature: reject.", __LINE__, {"feature", "0", "reject"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "feature" : "0", "vetoed" : true } ] - })"}, + })"}}, {"feature: too many arguments.", __LINE__, {"feature", "featureNameOrHexIsNotValidated", "accept", "anotherArg"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { @@ -2828,7 +2953,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"feature: neither accept nor reject.", __LINE__, { @@ -2837,7 +2962,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "veto", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "feature", "params" : [ { @@ -2846,7 +2972,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // fetch_info // ------------------------------------------------------------------ @@ -2856,32 +2982,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "fetch_info", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"fetch_info: clear.", __LINE__, {"fetch_info", "clear"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "clear" : true } ] - })"}, + })"}}, {"fetch_info: too many arguments.", __LINE__, {"fetch_info", "clear", "other"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "fetch_info", "params" : [ { @@ -2890,20 +3019,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"fetch_info: other trailing argument.", __LINE__, {"fetch_info", "too"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "fetch_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "too" : true } ] - })"}, + })"}}, // gateway_balances // ------------------------------------------------------------ @@ -2911,75 +3041,80 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"gateway_balances", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", } ] - })"}, + })"}}, {"gateway_balances: with ledger index.", __LINE__, {"gateway_balances", "890765", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "890765" } ] - })"}, + })"}}, {"gateway_balances: with text ledger index.", __LINE__, {"gateway_balances", "current", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "current" } ] - })"}, + })"}}, {"gateway_balances: with 64 character ledger hash.", __LINE__, {"gateway_balances", "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"gateway_balances: 1 hotwallet.", __LINE__, {"gateway_balances", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet_is_not_validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated" ] } ] - })"}, + })"}}, {"gateway_balances: 3 hotwallets.", __LINE__, { @@ -2991,11 +3126,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "hotwallet_is_not_validated_3", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "hotwallet" : [ "hotwallet_is_not_validated_1", @@ -3005,14 +3141,15 @@ static RPCCallTestData const rpcCallTestArray[] = { "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"gateway_balances: too few arguments.", __LINE__, { "gateway_balances", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { @@ -3021,12 +3158,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"gateway_balances: empty first argument.", __LINE__, {"gateway_balances", ""}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { @@ -3035,7 +3173,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid first parameter" } ] - })"}, + })"}}, {"gateway_balances: with ledger index but no gateway.", __LINE__, { @@ -3043,7 +3181,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "890765", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { @@ -3052,7 +3191,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid hotwallet" } ] - })"}, + })"}}, {"gateway_balances: with text ledger index but no gateway.", __LINE__, { @@ -3060,7 +3199,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "current", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { @@ -3069,7 +3209,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid hotwallet" } ] - })"}, + })"}}, {"gateway_balances: with 64 character ledger hash but no gateway.", __LINE__, { @@ -3077,7 +3217,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "gateway_balances", "params" : [ { @@ -3086,7 +3227,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid hotwallet" } ] - })"}, + })"}}, // get_counts // ------------------------------------------------------------------ @@ -3096,32 +3237,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "get_counts", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "get_counts", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"get_counts: with maximum count.", __LINE__, {"get_counts", "100"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "get_counts", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "min_count" : 100 } ] - })"}, + })"}}, {"get_counts: too many arguments.", __LINE__, {"get_counts", "100", "whatever"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "get_counts", "params" : [ { @@ -3130,7 +3274,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"get_counts: count too small.", __LINE__, { @@ -3138,12 +3282,12 @@ static RPCCallTestData const rpcCallTestArray[] = { "-1", }, RPCCallTestData::bad_cast, - R"()"}, + {""}}, {"get_counts: count too large.", __LINE__, {"get_counts", "4294967296"}, RPCCallTestData::bad_cast, - R"()"}, + {""}}, // json // ------------------------------------------------------------------------ @@ -3155,16 +3299,17 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "method" : "command" } ] - })"}, + })"}}, {"json: null object.", __LINE__, { @@ -3173,20 +3318,22 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "method" : "command" } ] - })"}, + })"}}, {"json: too few arguments.", __LINE__, {"json", "command"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json", "params" : [ { @@ -3195,12 +3342,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"json: too many arguments.", __LINE__, {"json", "command", R"({"json_argument":true})", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json", "params" : [ { @@ -3209,7 +3357,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"json: array, not object.", __LINE__, { @@ -3218,7 +3366,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"(["arg1","arg2"])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json", "params" : [ { @@ -3227,7 +3376,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"json: invalid json (note closing comma).", __LINE__, { @@ -3236,7 +3385,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json", "params" : [ { @@ -3245,7 +3395,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // json2 // ----------------------------------------------------------------------- @@ -3256,13 +3406,14 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3270,7 +3421,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: object with nested params.", __LINE__, { @@ -3284,13 +3435,14 @@ static RPCCallTestData const rpcCallTestArray[] = { })", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "0" : { "inner_arg" : "yup" }, @@ -3301,7 +3453,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: minimal array.", __LINE__, { @@ -3309,12 +3461,13 @@ static RPCCallTestData const rpcCallTestArray[] = { R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1"}])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "id" : "A1", "jsonrpc" : "2.0", "method" : "call_1", @@ -3322,7 +3475,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ] ] - })"}, + })"}}, {"json2: array with object with nested params.", __LINE__, { @@ -3336,12 +3489,13 @@ static RPCCallTestData const rpcCallTestArray[] = { ])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "0" : { "inner_arg" : "yup" }, @@ -3351,14 +3505,15 @@ static RPCCallTestData const rpcCallTestArray[] = { "ripplerpc" : "2.0" } ] - ]})"}, + ]})"}}, {"json2: too few arguments.", __LINE__, { "json2", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ { @@ -3367,14 +3522,15 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"json2: too many arguments.", __LINE__, {"json2", R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_this"})", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ { @@ -3383,7 +3539,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"json2: malformed json (note extra comma).", __LINE__, { @@ -3391,7 +3547,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "json2", @@ -3406,7 +3563,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: omit jsonrpc.", __LINE__, { @@ -3414,7 +3571,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"ripplerpc":"2.0","id":"A1","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "method" : "json2", "params" : [ @@ -3427,7 +3585,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: wrong jsonrpc version.", __LINE__, { @@ -3435,7 +3593,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.1","ripplerpc":"2.0","id":"A1","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.1", "method" : "json2", @@ -3450,7 +3609,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: omit ripplerpc.", __LINE__, { @@ -3458,7 +3617,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","id":"A1","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "json2", @@ -3471,7 +3631,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "jsonrpc" : "2.0" } ] - })"}, + })"}}, {"json2: wrong ripplerpc version.", __LINE__, { @@ -3479,7 +3639,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","ripplerpc":"2.00","id":"A1","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "json2", @@ -3494,7 +3655,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.00" - })"}, + })"}}, {"json2: omit id.", __LINE__, { @@ -3502,7 +3663,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","ripplerpc":"2.0","method":"call_1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "jsonrpc" : "2.0", "method" : "json2", "params" : [ @@ -3515,7 +3677,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: omit method.", __LINE__, { @@ -3523,7 +3685,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1"})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "json2", @@ -3538,7 +3701,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, {"json2: empty outer array.", __LINE__, { @@ -3546,7 +3709,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"([])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ { @@ -3555,7 +3719,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"json2: empty inner array.", __LINE__, { @@ -3563,7 +3727,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"([{"jsonrpc":"2.0","ripplerpc":"2.0","id":"A1","method":"call_1",[]}])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ { @@ -3572,7 +3737,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"json2: array with non-json2 object.", __LINE__, { @@ -3586,7 +3751,8 @@ static RPCCallTestData const rpcCallTestArray[] = { ])", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "json2", "params" : [ { @@ -3595,7 +3761,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"json2: non-object or -array inner params member.", __LINE__, { @@ -3609,7 +3775,8 @@ static RPCCallTestData const rpcCallTestArray[] = { })", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "id" : "A1", "jsonrpc" : "2.0", "method" : "json2", @@ -3624,7 +3791,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ], "ripplerpc" : "2.0" - })"}, + })"}}, // ledger // ---------------------------------------------------------------------- @@ -3632,148 +3799,159 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"ledger"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"ledger: ledger index.", __LINE__, {"ledger", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] - })"}, + })"}}, {"ledger: text ledger index.", __LINE__, {"ledger", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] - })"}, + })"}}, {"ledger: ledger hash.", __LINE__, {"ledger", "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] - })"}, + })"}}, {"ledger: full.", __LINE__, {"ledger", "current", "full"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "full" : true, "ledger_index" : "current" } ] - })"}, + })"}}, {"ledger: tx.", __LINE__, {"ledger", "closed", "tx"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "expand" : true, "ledger_index" : "closed", "transactions" : true } ] - })"}, + })"}}, {"ledger: too many arguments.", __LINE__, {"ledger", "4294967295", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] - })"}, + })"}}, {"ledger: ledger index too small.", __LINE__, {"ledger", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger: ledger index too big.", __LINE__, {"ledger", "4294967296"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger: invalid ledger text.", __LINE__, {"ledger", "latest"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger: unsupported final argument.", __LINE__, {"ledger", "current", "expand"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current" } ] - })"}, + })"}}, // ledger_closed // --------------------------------------------------------------- @@ -3781,19 +3959,21 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"ledger_closed"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_closed", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"ledger_closed: too many arguments.", __LINE__, {"ledger_closed", "today"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_closed", "params" : [ { @@ -3802,7 +3982,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // ledger_current // -------------------------------------------------------------- @@ -3810,19 +3990,21 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"ledger_current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_current", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"ledger_current: too many arguments.", __LINE__, {"ledger_current", "today"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_current", "params" : [ { @@ -3831,7 +4013,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // ledger_header // --------------------------------------------------------------- @@ -3839,36 +4021,39 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"ledger_header", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] - })"}, + })"}}, {"ledger_header: ledger hash.", __LINE__, {"ledger_header", "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] - })"}, + })"}}, {"ledger_header: too few arguments.", __LINE__, { "ledger_header", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { @@ -3877,12 +4062,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ledger_header: too many arguments.", __LINE__, {"ledger_header", "4294967295", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { @@ -3891,46 +4077,49 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ledger_header: text ledger index.", __LINE__, {"ledger_header", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger_header: ledger index too small.", __LINE__, {"ledger_header", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger_header: ledger index too big.", __LINE__, {"ledger_header", "4294967296"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_header", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, // ledger_request // -------------------------------------------------------------- @@ -3938,36 +4127,39 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"ledger_request", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295 } ] - })"}, + })"}}, {"ledger_request: ledger hash.", __LINE__, {"ledger_request", "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789" } ] - })"}, + })"}}, {"ledger_request: too few arguments.", __LINE__, { "ledger_request", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { @@ -3976,12 +4168,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ledger_request: too many arguments.", __LINE__, {"ledger_request", "4294967295", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { @@ -3990,46 +4183,49 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ledger_request: text ledger index.", __LINE__, {"ledger_request", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger_request: ledger index too small.", __LINE__, {"ledger_request", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, {"ledger_request: ledger index too big.", __LINE__, {"ledger_request", "4294967296"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ledger_request", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })"}, + })"}}, // log_level // ------------------------------------------------------------------- @@ -4039,112 +4235,121 @@ static RPCCallTestData const rpcCallTestArray[] = { "log_level", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"log_level: fatal.", __LINE__, {"log_level", "fatal"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "fatal" } ] - })"}, + })"}}, {"log_level: error.", __LINE__, {"log_level", "error"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "error" } ] - })"}, + })"}}, {"log_level: warn.", __LINE__, {"log_level", "warn"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "warn" } ] - })"}, + })"}}, {"log_level: debug.", __LINE__, {"log_level", "debug"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "debug" } ] - })"}, + })"}}, {"log_level: trace.", __LINE__, {"log_level", "trace"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "trace" } ] - })"}, + })"}}, {"log_level: base partition.", __LINE__, {"log_level", "base", "trace"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "base", "severity" : "trace" } ] - })"}, + })"}}, {"log_level: partiton_name.", __LINE__, {"log_level", "partition_name", "fatal"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "partition_name", "severity" : "fatal" } ] - })"}, + })"}}, {"log_level: too many arguments.", __LINE__, {"log_level", "partition_name", "fatal", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { @@ -4153,20 +4358,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"log_level: invalid severity.", __LINE__, {"log_level", "err"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "severity" : "err" } ] - })"}, + })"}}, {"log_level: swap partition name and severity.", __LINE__, { @@ -4175,16 +4381,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "partition_name", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "log_level", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "partition" : "fatal", "severity" : "partition_name" } ] - })"}, + })"}}, // logrotate // ------------------------------------------------------------------- @@ -4194,19 +4401,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "logrotate", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "logrotate", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"logrotate: too many arguments.", __LINE__, {"logrotate", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "logrotate", "params" : [ { @@ -4215,7 +4424,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // node_to_shard // ------------------------------------------------------------------- @@ -4223,46 +4432,50 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"node_to_shard", "status"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "status" } ] - })"}, + })"}}, {"node_to_shard: start.", __LINE__, {"node_to_shard", "start"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "start" } ] - })"}, + })"}}, {"node_to_shard: stop.", __LINE__, {"node_to_shard", "stop"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "stop" } ] - })"}, + })"}}, {"node_to_shard: too many arguments.", __LINE__, {"node_to_shard", "start", "stop"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "node_to_shard", "params" : [ { @@ -4271,20 +4484,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"node_to_shard: invalid argument.", __LINE__, {"node_to_shard", "invalid"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "node_to_shard", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "action" : "invalid" } ] - })"}, + })"}}, // owner_info // ------------------------------------------------------------------ @@ -4292,80 +4506,86 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh" } ] - })"}, + })"}}, {"owner_info: with numeric ledger index.", __LINE__, {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "987654321"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 987654321 } ] - })"}, + })"}}, {"owner_info: with text ledger index.", __LINE__, {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : "validated" } ] - })"}, + })"}}, {"owner_info: with ledger hash.", __LINE__, {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_hash" : "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" } ] - })"}, + })"}}, {"owner_info: with ledger index.", __LINE__, {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "validated" } ] - })"}, + })"}}, {"owner_info: too few arguments.", __LINE__, { "owner_info", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { @@ -4374,7 +4594,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"owner_info: too many arguments.", __LINE__, { @@ -4385,7 +4605,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "extra2", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "owner_info", "params" : [ { @@ -4394,16 +4615,17 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - "owner_info: invalid accountID.", - __LINE__, - { - "owner_info", - "", // Note: very few values are detected as bad! - }, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + "owner_info: invalid accountID.", + __LINE__, + { + "owner_info", + "", // Note: very few values are detected as bad! + }, + RPCCallTestData::no_exception, + { + R"({ "method" : "owner_info", "params" : [ { @@ -4412,44 +4634,43 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Account malformed." } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "owner_info: invalid ledger selection.", - __LINE__, - {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "owner_info: invalid ledger selection.", + __LINE__, + {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "owner_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "ledger_index" : 0 } ] - })", - }, - { - // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That - // cannot currently occur because jvParseLedger() always returns true. - "owner_info: invalid ledger selection.", - __LINE__, - {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, - RPCCallTestData::no_exception, - R"({ + })"}}, + {// + // Note: there is code in place to return rpcLGR_IDX_MALFORMED. That + // cannot currently occur because jvParseLedger() always returns true. + "owner_info: invalid ledger selection.", + __LINE__, + {"owner_info", "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "no_ledger"}, + RPCCallTestData::no_exception, + { + R"({ "method" : "owner_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 0 } ] - })", - }, + })"}}, // peers // ----------------------------------------------------------------------- @@ -4459,19 +4680,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "peers", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peers", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"peers: too many arguments.", __LINE__, {"peers", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peers", "params" : [ { @@ -4480,7 +4703,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // peer_reservations_add // ------------------------------------------------------- @@ -4488,34 +4711,37 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"peer_reservations_add", "public_key_string"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_add", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "public_key" : "public_key_string" } ] - })"}, + })"}}, {"peer_reservations_add: with description.", __LINE__, {"peer_reservations_add", "public_key_string", "public_key_description"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_add", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "description" : "public_key_description", "public_key" : "public_key_string" } ] - })"}, + })"}}, {"peer_reservations_add: too few arguments.", __LINE__, {"peer_reservations_add"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_add", "params" : [ { @@ -4524,7 +4750,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"peer_reservations_add: too many arguments.", __LINE__, {"peer_reservations_add", @@ -4532,7 +4758,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "public_key_description", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_add", "params" : [ { @@ -4541,7 +4768,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // peer_reservations_del // ------------------------------------------------------- @@ -4549,20 +4776,22 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"peer_reservations_del", "public_key_string"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_del", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "public_key" : "public_key_string" } ] - })"}, + })"}}, {"peer_reservations_del: too few arguments.", __LINE__, {"peer_reservations_del"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_del", "params" : [ { @@ -4571,7 +4800,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"peer_reservations_del: too many arguments.", __LINE__, {"peer_reservations_del", @@ -4579,7 +4808,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "public_key_description", "spare"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "peer_reservations_del", "params" : [ { @@ -4588,7 +4818,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // ping // ------------------------------------------------------------------------ @@ -4598,19 +4828,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "ping", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ping", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"ping: too many arguments.", __LINE__, {"ping", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ping", "params" : [ { @@ -4619,7 +4851,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // print // ----------------------------------------------------------------------- @@ -4629,33 +4861,37 @@ static RPCCallTestData const rpcCallTestArray[] = { "print", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "print", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, - {// The docs indicate that no arguments are allowed. So should this error? + })"}}, + {// + // The docs indicate that no arguments are allowed. So should this error? "print: extra argument.", __LINE__, {"print", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "print", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "params" : [ "extra" ] } ] - })"}, + })"}}, {"print: too many arguments.", __LINE__, {"print", "extra1", "extra2"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "print", "params" : [ { @@ -4664,7 +4900,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // random // ---------------------------------------------------------------------- @@ -4674,19 +4910,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "random", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "random", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"random: too many arguments.", __LINE__, {"random", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "random", "params" : [ { @@ -4695,7 +4933,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // ripple_path_find // ------------------------------------------------------------ @@ -4706,59 +4944,63 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true } ] - })"}, + })"}}, {"ripple_path_find: ledger index.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 4294967295 } ] - })"}, + })"}}, {"ripple_path_find: text ledger index.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "closed"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : "closed" } ] - })"}, + })"}}, {"ripple_path_find: ledger hash.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"ripple_path_find: too few arguments.", __LINE__, @@ -4766,7 +5008,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "ripple_path_find", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { @@ -4775,12 +5018,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ripple_path_find: too many arguments.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "current", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { @@ -4789,7 +5033,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"ripple_path_find: invalid json (note extra comma).", __LINE__, { @@ -4797,7 +5041,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { @@ -4806,49 +5051,52 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"ripple_path_find: ledger index too small.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "-1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } ] - })"}, + })"}}, {"ripple_path_find: ledger index too big.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "4294967296"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } ] - })"}, + })"}}, {"ripple_path_find: invalid text ledger index.", __LINE__, {"ripple_path_find", R"({"json_argument":true})", "cur"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "ripple_path_find", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "json_argument" : true, "ledger_index" : 0 } ] - })"}, + })"}}, // sign // ------------------------------------------------------------------------ @@ -4860,27 +5108,29 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true } } ] - })"}, + })"}}, {"sign: offline.", __LINE__, {"sign", "my_secret", R"({"json_argument":true})", "offline"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -4888,12 +5138,13 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"sign: too few arguments.", __LINE__, {"sign", "contents_of_blob"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { @@ -4902,12 +5153,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"sign: too many arguments.", __LINE__, {"sign", "my_secret", R"({"json_argument":true})", "offline", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { @@ -4916,7 +5168,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"sign: invalid JSON (note extra comma).", __LINE__, { @@ -4925,7 +5177,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { @@ -4934,12 +5187,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"sign: invalid final argument.", __LINE__, {"sign", "my_secret", R"({"json_argument":true})", "offlin"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign", "params" : [ { @@ -4948,7 +5202,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // sign_for // -------------------------------------------------------------------- @@ -4961,11 +5215,12 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret" : "my_secret", "tx_json" : { @@ -4973,7 +5228,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"sign_for: offline.", __LINE__, {"sign_for", @@ -4982,11 +5237,12 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", "offline"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "offline" : true, "secret" : "my_secret", @@ -4995,7 +5251,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"sign_for: too few arguments.", __LINE__, { @@ -5004,7 +5260,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "my_secret", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { @@ -5013,7 +5270,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"sign_for: too many arguments.", __LINE__, {"sign_for", @@ -5023,7 +5280,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "offline", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { @@ -5032,7 +5290,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"sign_for: invalid json (note extra comma).", __LINE__, { @@ -5042,7 +5300,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { @@ -5051,7 +5310,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"sign_for: invalid final argument.", __LINE__, {"sign_for", @@ -5060,7 +5319,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", "ofline"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "sign_for", "params" : [ { @@ -5069,7 +5329,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // submit // ---------------------------------------------------------------------- @@ -5077,15 +5337,16 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"submit", "the blob is unvalidated and may be any length..."}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "tx_blob" : "the blob is unvalidated and may be any length..." } ] - })"}, + })"}}, {"submit: json.", __LINE__, { @@ -5094,25 +5355,27 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "my_secret", "tx_json" : { "json_argument" : true } } ] - })"}, + })"}}, {"submit: too few arguments.", __LINE__, { "submit", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { @@ -5121,17 +5384,19 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - {// Note: I believe this _ought_ to be detected as too many arguments. + })"}}, + {// + // Note: I believe this _ought_ to be detected as too many arguments. "submit: four arguments.", __LINE__, {"submit", "my_secret", R"({"json_argument":true})", "offline"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "offline" : true, "secret" : "my_secret", "tx_json" : { @@ -5139,12 +5404,13 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, {"submit: too many arguments.", __LINE__, {"submit", "my_secret", R"({"json_argument":true})", "offline", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { @@ -5153,7 +5419,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"submit: invalid json (note extra comma).", __LINE__, { @@ -5162,7 +5428,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { @@ -5171,12 +5438,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"submit: last argument not \"offline\".", __LINE__, {"submit", "my_secret", R"({"json_argument":true})", "offlne"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit", "params" : [ { @@ -5185,7 +5453,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // submit_multisigned // ---------------------------------------------------------- @@ -5196,24 +5464,26 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit_multisigned", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "tx_json" : { "json_argument" : true } } ] - })"}, + })"}}, {"submit_multisigned: too few arguments.", __LINE__, { "submit_multisigned", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit_multisigned", "params" : [ { @@ -5222,12 +5492,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"submit_multisigned: too many arguments.", __LINE__, {"submit_multisigned", R"({"json_argument":true})", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit_multisigned", "params" : [ { @@ -5236,7 +5507,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"submit_multisigned: invalid json (note extra comma).", __LINE__, { @@ -5244,7 +5515,8 @@ static RPCCallTestData const rpcCallTestArray[] = { R"({"json_argument":true,})", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "submit_multisigned", "params" : [ { @@ -5254,7 +5526,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } } ] - })"}, + })"}}, // server_info // ----------------------------------------------------------------- @@ -5264,32 +5536,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "server_info", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"server_info: counters.", __LINE__, {"server_info", "counters"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "counters" : true } ] - })"}, + })"}}, {"server_info: too many arguments.", __LINE__, {"server_info", "counters", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_info", "params" : [ { @@ -5298,19 +5573,20 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"server_info: non-counters argument.", __LINE__, {"server_info", "counter"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_info", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, // server_state // ---------------------------------------------------------------- @@ -5320,32 +5596,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "server_state", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"server_state: counters.", __LINE__, {"server_state", "counters"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "counters" : true } ] - })"}, + })"}}, {"server_state: too many arguments.", __LINE__, {"server_state", "counters", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_state", "params" : [ { @@ -5354,19 +5633,20 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"server_state: non-counters argument.", __LINE__, {"server_state", "counter"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "server_state", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, // stop // ------------------------------------------------------------------------ @@ -5376,19 +5656,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "stop", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "stop", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"stop: too many arguments.", __LINE__, {"stop", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "stop", "params" : [ { @@ -5397,7 +5679,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // transaction_entry // ----------------------------------------------------------- @@ -5407,48 +5689,51 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", "4294967295"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : 4294967295, "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"transaction_entry: text ledger index.", __LINE__, {"transaction_entry", "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", "current"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_index" : "current", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"transaction_entry: ledger hash.", __LINE__, {"transaction_entry", "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ledger_hash" : "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210", "tx_hash" : "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV" } ] - })"}, + })"}}, {"transaction_entry: too few arguments.", __LINE__, { @@ -5456,7 +5741,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0123456789ABCDEFGHIJKLMNOPQRSTUV0123456789ABCDEFGHIJKLMNOPQRSTUV", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5465,7 +5751,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"transaction_entry: too many arguments.", __LINE__, {"transaction_entry", @@ -5473,7 +5759,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "validated", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5482,7 +5769,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"transaction_entry: short tx_hash.", __LINE__, { @@ -5491,7 +5778,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "validated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5500,7 +5788,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"transaction_entry: long tx_hash.", __LINE__, { @@ -5509,7 +5797,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "validated", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5518,7 +5807,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"transaction_entry: small ledger index.", __LINE__, { @@ -5527,7 +5816,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "0", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5536,7 +5826,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"transaction_entry: large ledger index.", __LINE__, { @@ -5545,7 +5835,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "4294967296", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5554,7 +5845,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"transaction_entry: short ledger hash.", __LINE__, { @@ -5563,7 +5854,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA987654321", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5572,7 +5864,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, {"transaction_entry: long ledger hash.", __LINE__, { @@ -5581,7 +5873,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "VUTSRQPONMLKJIHGFEDCBA9876543210VUTSRQPONMLKJIHGFEDCBA9876543210Z", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "transaction_entry", "params" : [ { @@ -5590,7 +5883,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Invalid parameters." } ] - })"}, + })"}}, // tx // -------------------------------------------------------------------------- @@ -5598,67 +5891,72 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"tx", "FFFFFFFFFFFFFFFF", "1", "2"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "ctid" : "FFFFFFFFFFFFFFFF", "max_ledger" : "2", "min_ledger" : "1" } ] - })"}, + })"}}, {"tx: ctid. binary", __LINE__, {"tx", "FFFFFFFFFFFFFFFF", "binary", "1", "2"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "binary" : true, "ctid" : "FFFFFFFFFFFFFFFF", "max_ledger" : "2", "min_ledger" : "1" } ] - })"}, + })"}}, {"tx: minimal.", __LINE__, {"tx", "transaction_hash_is_not_validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] - })"}, + })"}}, {"tx: binary.", __LINE__, {"tx", "transaction_hash_is_not_validated", "binary"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "binary" : true, "transaction" : "transaction_hash_is_not_validated" } ] - })"}, + })"}}, {"tx: too few arguments.", __LINE__, { "tx", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { @@ -5667,12 +5965,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"tx: too many arguments.", __LINE__, {"tx", "transaction_hash_is_not_validated", "binary", "1", "2", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { @@ -5681,20 +5980,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"tx: invalid final argument is apparently ignored.", __LINE__, {"tx", "transaction_hash_is_not_validated", "bin"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "transaction" : "transaction_hash_is_not_validated" } ] - })"}, + })"}}, // tx_history // ------------------------------------------------------------------ @@ -5702,22 +6002,24 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"tx_history", "0"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx_history", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "start" : 0 } ] - })"}, + })"}}, {"tx_history: too few arguments.", __LINE__, { "tx_history", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx_history", "params" : [ { @@ -5726,12 +6028,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, {"tx_history: too many arguments.", __LINE__, {"tx_history", "0", "1"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "tx_history", "params" : [ { @@ -5740,31 +6043,28 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_history: start too small.", - __LINE__, - {"tx_history", "-1"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_history: start too big.", - __LINE__, - {"tx_history", "4294967296"}, - RPCCallTestData::bad_cast, - R"()", - }, - { - // Note: this really shouldn't throw, but does at the moment. - "tx_history: start not integer.", - __LINE__, - {"tx_history", "beginning"}, - RPCCallTestData::bad_cast, - R"()", - }, + })"}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "tx_history: start too small.", + __LINE__, + {"tx_history", "-1"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "tx_history: start too big.", + __LINE__, + {"tx_history", "4294967296"}, + RPCCallTestData::bad_cast, + {""}}, + {// + // Note: this really shouldn't throw, but does at the moment. + "tx_history: start not integer.", + __LINE__, + {"tx_history", "beginning"}, + RPCCallTestData::bad_cast, + {""}}, // unl_list // -------------------------------------------------------------------- @@ -5774,19 +6074,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "unl_list", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unl_list", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"unl_list: too many arguments.", __LINE__, {"unl_list", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unl_list", "params" : [ { @@ -5795,7 +6097,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // validation_create // ----------------------------------------------------------- @@ -5805,32 +6107,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "validation_create", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "validation_create", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"validation_create: with secret.", __LINE__, {"validation_create", "the form of the secret is not validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "validation_create", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "secret" : "the form of the secret is not validated" } ] - })"}, + })"}}, {"validation_create: too many arguments.", __LINE__, {"validation_create", "the form of the secret is not validated", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "validation_create", "params" : [ { @@ -5839,7 +6144,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // version // --------------------------------------------------------------------- @@ -5849,19 +6154,21 @@ static RPCCallTestData const rpcCallTestArray[] = { "version", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "version", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"version: too many arguments.", __LINE__, {"version", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "version", "params" : [ { @@ -5870,7 +6177,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // wallet_propose // -------------------------------------------------------------- @@ -5880,32 +6187,35 @@ static RPCCallTestData const rpcCallTestArray[] = { "wallet_propose", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "wallet_propose", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"wallet_propose: with passphrase.", __LINE__, {"wallet_propose", "the form of the passphrase is not validated"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "wallet_propose", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "passphrase" : "the form of the passphrase is not validated" } ] - })"}, + })"}}, {"wallet_propose: too many arguments.", __LINE__, {"wallet_propose", "the form of the passphrase is not validated", "extra"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "wallet_propose", "params" : [ { @@ -5914,7 +6224,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // internal // -------------------------------------------------------------------- @@ -5922,16 +6232,17 @@ static RPCCallTestData const rpcCallTestArray[] = { __LINE__, {"internal", "command_name"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "internal", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "internal_command" : "command_name", "params" : [] } ] - })"}, + })"}}, {"internal: with parameters.", __LINE__, {"internal", @@ -5942,23 +6253,25 @@ static RPCCallTestData const rpcCallTestArray[] = { "4294967296", "3.14159"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "internal", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "internal_command" : "command_name", "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } ] - })"}, + })"}}, {"internal: too few arguments.", __LINE__, { "internal", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "internal", "params" : [ { @@ -5967,7 +6280,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Syntax error." } ] - })"}, + })"}}, // path_find // ------------------------------------------------------------------- @@ -5977,7 +6290,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "path_find", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "path_find", "params" : [ { @@ -5986,12 +6300,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, {"path_find: with arguments.", __LINE__, {"path_find", "string_arg", "1", "-1", "4294967296", "3.14159"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "path_find", "params" : [ { @@ -6000,7 +6315,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, // subscribe // ------------------------------------------------------------------- @@ -6010,7 +6325,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "subscribe", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "subscribe", "params" : [ { @@ -6019,12 +6335,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, {"subscribe: with arguments.", __LINE__, {"subscribe", "string_arg", "1", "-1", "4294967296", "3.14159"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "subscribe", "params" : [ { @@ -6033,7 +6350,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, // unsubscribe // ----------------------------------------------------------------- @@ -6043,7 +6360,8 @@ static RPCCallTestData const rpcCallTestArray[] = { "unsubscribe", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unsubscribe", "params" : [ { @@ -6052,12 +6370,13 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, {"unsubscribe: with arguments.", __LINE__, {"unsubscribe", "string_arg", "1", "-1", "4294967296", "3.14159"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unsubscribe", "params" : [ { @@ -6066,7 +6385,7 @@ static RPCCallTestData const rpcCallTestArray[] = { "error_message" : "Current transport does not support events." } ] - })"}, + })"}}, // unknown_command // ------------------------------------------------------------- @@ -6076,35 +6395,36 @@ static RPCCallTestData const rpcCallTestArray[] = { "unknown_command", }, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unknown_command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, } ] - })"}, + })"}}, {"unknown_command: with arguments.", __LINE__, {"unknown_command", "string_arg", "1", "-1", "4294967296", "3.14159"}, RPCCallTestData::no_exception, - R"({ + { + R"({ "method" : "unknown_command", "params" : [ { - "api_version" : %MAX_API_VER%, + "api_version" : %API_VER%, "params" : [ "string_arg", "1", "-1", "4294967296", "3.14159" ] } ] - })"}, + })"}}, }; std::string -updateAPIVersionString(const char* const req) +updateAPIVersionString(const char* const req, unsigned apiVersion) { - static std::string version_str = - std::to_string(RPC::apiMaximumSupportedVersion); - static auto place_holder = "%MAX_API_VER%"; + std::string const version_str = std::to_string(apiVersion); + static auto place_holder = "%API_VER%"; std::string jr(req); boost::replace_all(jr, place_holder, version_str); return jr; @@ -6124,9 +6444,11 @@ class RPCCall_test : public beast::unit_test::suite { public: void - testRPCCall() + testRPCCall(unsigned apiVersion) { - testcase << "RPCCall"; + testcase << "RPCCall API version " << apiVersion; + assert(apiVersion > 0); + assert(apiVersion <= RPC::apiMaximumValidVersion); test::jtx::Env env( *this, makeNetworkConfig(11111)); // Used only for its Journal. @@ -6136,19 +6458,22 @@ class RPCCall_test : public beast::unit_test::suite { std::vector const args{ rpcCallTest.args.begin(), rpcCallTest.args.end()}; + const char* const expVersioned = + rpcCallTest.exp.size() >= apiVersion + ? rpcCallTest.exp[apiVersion - 1] + : rpcCallTest.exp.back(); // Note that, over the long term, none of these tests should // throw. But, for the moment, some of them do. So handle it. Json::Value got; try { - got = jtx::cmdToJSONRPC( - args, env.journal, RPC::apiMaximumSupportedVersion); + got = jtx::cmdToJSONRPC(args, env.journal, apiVersion); } catch (std::bad_cast const&) { if ((rpcCallTest.throwsWhat == RPCCallTestData::bad_cast) && - (std::strlen(rpcCallTest.exp) == 0)) + (std::strlen(expVersioned) == 0)) { pass(); } @@ -6161,7 +6486,8 @@ class RPCCall_test : public beast::unit_test::suite } Json::Value exp; - Json::Reader{}.parse(updateAPIVersionString(rpcCallTest.exp), exp); + Json::Reader{}.parse( + updateAPIVersionString(expVersioned, apiVersion), exp); // Lambda to remove the "params[0u]:error_code" field if present. // Error codes are not expected to be stable between releases. @@ -6192,7 +6518,8 @@ class RPCCall_test : public beast::unit_test::suite void run() override { - testRPCCall(); + test::jtx::forAllApiVersions( + std::bind_front(&RPCCall_test::testRPCCall, this)); } };