diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index 1d58c5c02..7ab30ac9a 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include namespace ripple { @@ -36,6 +36,7 @@ namespace RPC { struct TxnTestData { char const* const description; + int const line; char const* const json; // The JSON is applied to four different interfaces: // 1. sign, @@ -46,20 +47,27 @@ struct TxnTestData // crash none of them, and should provide reliable error messages. // // The expMsg array contains the expected error string for the above cases. - char const* const expMsg[4]; + std::array const expMsg; - // Default and copy ctors should be deleted, but that displeases gcc 4.6.3. -// TxnTestData () = delete; -// TxnTestData (TxnTestData const&) = delete; -// TxnTestData (TxnTestData&&) = delete; + constexpr TxnTestData (char const* description_, int line_, + char const* json_, std::array const& expMsg_) + : description (description_) + , line (line_) + , json (json_) + , expMsg {expMsg_} + { } + + TxnTestData () = delete; + TxnTestData (TxnTestData const&) = delete; + TxnTestData (TxnTestData&&) = delete; TxnTestData& operator= (TxnTestData const&) = delete; TxnTestData& operator= (TxnTestData&&) = delete; }; -static TxnTestData const txnTestArray [] = +static constexpr TxnTestData txnTestArray [] = { -{ "Minimal payment.", +{ "Minimal payment.", __LINE__, R"({ "command": "doesnt_matter", "secret": "masterpassphrase", @@ -70,13 +78,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'account'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Pass in Fee with minimal payment.", +{ "Pass in Fee with minimal payment.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -89,13 +97,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Pass in Sequence.", +{ "Pass in Sequence.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -108,13 +116,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Pass in Sequence and Fee with minimal payment.", +{ "Pass in Sequence and Fee with minimal payment.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -128,13 +136,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh).", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Add 'fee_mult_max' field.", +{ "Add 'fee_mult_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -148,13 +156,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Add 'fee_mult_max' and 'fee_div_max' field.", +{ "Add 'fee_mult_max' and 'fee_div_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -169,13 +177,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "fee_mult_max is ignored if 'Fee' is present.", +{ "fee_mult_max is ignored if 'Fee' is present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -190,13 +198,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh).", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "fee_div_max is ignored if 'Fee' is present.", +{ "fee_div_max is ignored if 'Fee' is present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -212,13 +220,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh).", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Invalid 'fee_mult_max' field.", +{ "Invalid 'fee_mult_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -232,13 +240,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'fee_mult_max', not a positive integer.", "Invalid field 'fee_mult_max', not a positive integer.", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Invalid 'fee_div_max' field.", +{ "Invalid 'fee_div_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -253,13 +261,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'fee_div_max', not a positive integer.", "Invalid field 'fee_div_max', not a positive integer.", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Invalid value for 'fee_mult_max' field.", +{ "Invalid value for 'fee_mult_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -273,13 +281,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Fee of 10 exceeds the requested tx limit of 0", "Fee of 10 exceeds the requested tx limit of 0", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Invalid value for 'fee_div_max' field.", +{ "Invalid value for 'fee_div_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -294,13 +302,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Fee of 10 exceeds the requested tx limit of 5", "Fee of 10 exceeds the requested tx limit of 5", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Invalid zero value for 'fee_div_max' field.", +{ "Invalid zero value for 'fee_div_max' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -315,13 +323,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'fee_div_max', not a positive integer.", "Invalid field 'fee_div_max', not a positive integer.", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Missing 'Amount'.", +{ "Missing 'Amount'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -332,13 +340,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Amount'.", "Missing field 'tx_json.Amount'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Invalid 'Amount'.", +{ "Invalid 'Amount'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -350,13 +358,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'tx_json.Amount'.", "Invalid field 'tx_json.Amount'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Missing 'Destination'.", +{ "Missing 'Destination'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -367,13 +375,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Destination'.", "Missing field 'tx_json.Destination'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Invalid 'Destination'.", +{ "Invalid 'Destination'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -385,13 +393,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'tx_json.Destination'.", "Invalid field 'tx_json.Destination'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Cannot create XRP to XRP paths.", +{ "Cannot create XRP to XRP paths.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -404,13 +412,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Cannot build XRP to XRP paths.", "Cannot build XRP to XRP paths.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Successful 'build_path'.", +{ "Successful 'build_path'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -427,13 +435,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Not valid to include both 'Paths' and 'build_path'.", +{ "Not valid to include both 'Paths' and 'build_path'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -451,13 +459,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Cannot specify both 'tx_json.Paths' and 'build_path'", "Cannot specify both 'tx_json.Paths' and 'build_path'", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Successful 'SendMax'.", +{ "Successful 'SendMax'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -479,13 +487,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Even though 'Amount' may not be XRP for pathfinding, 'SendMax' may be XRP.", +{ "'Amount' may not be XRP for pathfinding, but 'SendMax' may be XRP.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -503,13 +511,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "'secret' must be present.", +{ "'secret' must be present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -520,13 +528,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "'secret' must be non-empty.", +{ "'secret' must be non-empty.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -538,13 +546,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'secret'.", "Invalid field 'secret'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Use 'seed' instead of 'secret'.", +{ "Use 'seed' instead of 'secret'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", @@ -557,13 +565,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Malformed 'seed'.", +{ "Malformed 'seed'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", @@ -576,13 +584,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Disallowed seed.", "Disallowed seed.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "'tx_json' must be present.", +{ "'tx_json' must be present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -594,13 +602,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json'.", "Missing field 'tx_json'.", "Missing field 'tx_json'.", -"Missing field 'tx_json'."}}, +"Missing field 'tx_json'."}}}, -{ "'TransactionType' must be present.", +{ "'TransactionType' must be present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -611,13 +619,13 @@ R"({ "Destination": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", } })", -{ +{{ "Missing field 'tx_json.TransactionType'.", "Missing field 'tx_json.TransactionType'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "The 'TransactionType' must be one of the pre-established transaction types.", +{ "The 'TransactionType' must be a pre-established transaction type.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -629,13 +637,13 @@ R"({ "TransactionType": "tt" } })", -{ +{{ "Field 'tx_json.TransactionType' has invalid data.", "Field 'tx_json.TransactionType' has invalid data.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "The 'TransactionType', however, may be represented with an integer.", +{ "The 'TransactionType' may be represented with an integer.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -647,13 +655,13 @@ R"({ "TransactionType": 0 } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "'Account' must be present.", +{ "'Account' must be present.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -664,13 +672,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Account'.", "Missing field 'tx_json.Account'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "'Account' must be well formed.", +{ "'Account' must be well formed.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -682,13 +690,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Invalid field 'tx_json.Account'.", "Invalid field 'tx_json.Account'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "The 'offline' tag may be added to the transaction.", +{ "The 'offline' tag may be added to the transaction.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -701,13 +709,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "If 'offline' is true then a 'Sequence' field must be supplied.", +{ "If 'offline' is true then a 'Sequence' field must be supplied.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -721,13 +729,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Sequence'.", "Missing field 'tx_json.Sequence'.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "If 'offline' is true then a 'Fee' field must be supplied.", +{ "If 'offline' is true then a 'Fee' field must be supplied.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -741,13 +749,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Fee'.", "Missing field 'tx_json.Fee'.", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Valid transaction if 'offline' is true.", +{ "Valid transaction if 'offline' is true.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -762,13 +770,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh).", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "'offline' and 'build_path' are mutually exclusive.", +{ "'offline' and 'build_path' are mutually exclusive.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -784,13 +792,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Field 'build_path' not allowed in this context.", "Field 'build_path' not allowed in this context.", "Field 'build_path' not allowed in this context.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "A 'Flags' field may be specified.", +{ "A 'Flags' field may be specified.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -803,13 +811,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "The 'Flags' field must be numeric.", +{ "The 'Flags' field must be numeric.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -822,13 +830,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Field 'tx_json.Flags' has invalid data.", "Field 'tx_json.Flags' has invalid data.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "It's okay to add a 'debug_signing' field.", +{ "It's okay to add a 'debug_signing' field.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -841,13 +849,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Minimal sign_for.", +{ "Minimal sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -862,13 +870,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "", -"Missing field 'tx_json.Signers'."}}, +"Missing field 'tx_json.Signers'."}}}, -{ "Minimal offline sign_for.", +{ "Minimal offline sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -884,13 +892,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "", -"Missing field 'tx_json.Signers'."}}, +"Missing field 'tx_json.Signers'."}}}, -{ "Offline sign_for using 'seed' instead of 'secret'.", +{ "Offline sign_for using 'seed' instead of 'secret'.", __LINE__, R"({ "command": "doesnt_matter", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", @@ -907,13 +915,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "", -"Missing field 'tx_json.Signers'."}}, +"Missing field 'tx_json.Signers'."}}}, -{ "Malformed seed in sign_for.", +{ "Malformed seed in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", @@ -930,13 +938,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Disallowed seed.", "Disallowed seed.", "Disallowed seed.", -"Missing field 'tx_json.Signers'."}}, +"Missing field 'tx_json.Signers'."}}}, -{ "Missing 'Account' in sign_for.", +{ "Missing 'Account' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -950,13 +958,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Account'.", "Missing field 'tx_json.Account'.", "Missing field 'tx_json.Account'.", -"Missing field 'tx_json.Account'."}}, +"Missing field 'tx_json.Account'."}}}, -{ "Missing 'Amount' in sign_for.", +{ "Missing 'Amount' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -970,13 +978,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Amount'.", "Missing field 'tx_json.Amount'.", "Missing field 'tx_json.Amount'.", -"Missing field 'tx_json.Amount'."}}, +"Missing field 'tx_json.Amount'."}}}, -{ "Missing 'Destination' in sign_for.", +{ "Missing 'Destination' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -990,13 +998,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'tx_json.Destination'.", "Missing field 'tx_json.Destination'.", "Missing field 'tx_json.Destination'.", -"Missing field 'tx_json.Destination'."}}, +"Missing field 'tx_json.Destination'."}}}, -{ "Missing 'Fee' in sign_for.", +{ "Missing 'Fee' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1010,13 +1018,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "Missing field 'tx_json.Fee'.", -"Missing field 'tx_json.Fee'."}}, +"Missing field 'tx_json.Fee'."}}}, -{ "Missing 'Sequence' in sign_for.", +{ "Missing 'Sequence' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1030,13 +1038,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "Missing field 'tx_json.Sequence'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Missing 'SigningPubKey' in sign_for is automatically filled in.", +{ "Missing 'SigningPubKey' in sign_for is automatically filled in.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1050,13 +1058,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "In sign_for, an account may not sign for itself.", +{ "In sign_for, an account may not sign for itself.", __LINE__, R"({ "command": "doesnt_matter", "account": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", @@ -1070,13 +1078,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "", "", "A Signer may not be the transaction's Account (rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA).", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Cannot put duplicate accounts in Signers array", +{ "Cannot put duplicate accounts in Signers array", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1100,13 +1108,13 @@ R"({ "TransactionType" : "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "Duplicate Signers:Signer:Account entries (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh) are not allowed.", -""}}, +""}}}, -{ "Correctly append to pre-established Signers array", +{ "Correctly append to pre-established Signers array", __LINE__, R"({ "command": "doesnt_matter", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", @@ -1130,13 +1138,13 @@ R"({ "TransactionType" : "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "", -""}}, +""}}}, -{ "Append to pre-established Signers array with bad signature", +{ "Append to pre-established Signers array with bad signature", __LINE__, R"({ "command": "doesnt_matter", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", @@ -1160,13 +1168,13 @@ R"({ "TransactionType" : "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "Invalid signature.", -"Invalid signature."}}, +"Invalid signature."}}}, -{ "Non-empty 'SigningPubKey' in sign_for.", +{ "Non-empty 'SigningPubKey' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1181,13 +1189,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Secret does not match account.", "Secret does not match account.", "When multi-signing 'tx_json.SigningPubKey' must be empty.", -"When multi-signing 'tx_json.SigningPubKey' must be empty."}}, +"When multi-signing 'tx_json.SigningPubKey' must be empty."}}}, -{ "Missing 'TransactionType' in sign_for.", +{ "Missing 'TransactionType' in sign_for.", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -1201,52 +1209,52 @@ R"({ "SigningPubKey": "", } })", -{ +{{ "Missing field 'tx_json.TransactionType'.", "Missing field 'tx_json.TransactionType'.", "Missing field 'tx_json.TransactionType'.", -"Missing field 'tx_json.TransactionType'."}}, +"Missing field 'tx_json.TransactionType'."}}}, -{ "Invalid field 'tx_json': string instead of object", +{ "Invalid field 'tx_json': string instead of object", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": "" })", -{ +{{ "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", -"Invalid field 'tx_json', not object."}}, +"Invalid field 'tx_json', not object."}}}, -{ "Invalid field 'tx_json': integer instead of object", +{ "Invalid field 'tx_json': integer instead of object", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": 20160331 })", -{ +{{ "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", -"Invalid field 'tx_json', not object."}}, +"Invalid field 'tx_json', not object."}}}, -{ "Invalid field 'tx_json': array instead of object", +{ "Invalid field 'tx_json': array instead of object", __LINE__, R"({ "command": "doesnt_matter", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": [ "hello", "world" ] })", -{ +{{ "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", "Invalid field 'tx_json', not object.", -"Invalid field 'tx_json', not object."}}, +"Invalid field 'tx_json', not object."}}}, -{ "Minimal submit_multisigned.", +{ "Minimal submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1268,13 +1276,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -""}}, +""}}}, -{ "Minimal submit_multisigned with bad signature.", +{ "Minimal submit_multisigned with bad signature.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1296,13 +1304,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Invalid signature."}}, +"Invalid signature."}}}, -{ "Missing tx_json in submit_multisigned.", +{ "Missing tx_json in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "Signers": [ @@ -1315,13 +1323,13 @@ R"({ } ] })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json'."}}, +"Missing field 'tx_json'."}}}, -{ "Missing sequence in submit_multisigned.", +{ "Missing sequence in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1342,13 +1350,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Sequence'."}}, +"Missing field 'tx_json.Sequence'."}}}, -{ "Missing SigningPubKey in submit_multisigned.", +{ "Missing SigningPubKey in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1369,13 +1377,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.SigningPubKey'."}}, +"Missing field 'tx_json.SigningPubKey'."}}}, -{ "Non-empty SigningPubKey in submit_multisigned.", +{ "Non-empty SigningPubKey in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1397,13 +1405,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"When multi-signing 'tx_json.SigningPubKey' must be empty."}}, +"When multi-signing 'tx_json.SigningPubKey' must be empty."}}}, -{ "Missing TransactionType in submit_multisigned.", +{ "Missing TransactionType in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1424,13 +1432,13 @@ R"({ "SigningPubKey": "", } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.TransactionType'."}}, +"Missing field 'tx_json.TransactionType'."}}}, -{ "Missing Account in submit_multisigned.", +{ "Missing Account in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1451,13 +1459,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Account'."}}, +"Missing field 'tx_json.Account'."}}}, -{ "Malformed Account in submit_multisigned.", +{ "Malformed Account in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1479,13 +1487,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Invalid field 'tx_json.Account'."}}, +"Invalid field 'tx_json.Account'."}}}, -{ "Account not in ledger in submit_multisigned.", +{ "Account not in ledger in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1507,13 +1515,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Source account not found."}}, +"Source account not found."}}}, -{ "Missing Fee in submit_multisigned.", +{ "Missing Fee in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1534,13 +1542,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Fee'."}}, +"Missing field 'tx_json.Fee'."}}}, -{ "Non-numeric Fee in submit_multisigned.", +{ "Non-numeric Fee in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1562,13 +1570,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Field 'tx_json.Fee' has invalid data."}}, +"Field 'tx_json.Fee' has invalid data."}}}, -{ "Missing Amount in submit_multisigned Payment.", +{ "Missing Amount in submit_multisigned Payment.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1589,13 +1597,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Amount'."}}, +"Missing field 'tx_json.Amount'."}}}, -{ "Invalid Amount in submit_multisigned Payment.", +{ "Invalid Amount in submit_multisigned Payment.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1617,13 +1625,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Invalid field 'tx_json.Amount'."}}, +"Invalid field 'tx_json.Amount'."}}}, -{ "No build_path in submit_multisigned.", +{ "No build_path in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "build_path": 1, @@ -1646,13 +1654,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Field 'build_path' not allowed in this context."}}, +"Field 'build_path' not allowed in this context."}}}, -{ "Missing Destination in submit_multisigned Payment.", +{ "Missing Destination in submit_multisigned Payment.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1673,13 +1681,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Destination'."}}, +"Missing field 'tx_json.Destination'."}}}, -{ "Malformed Destination in submit_multisigned Payment.", +{ "Malformed Destination in submit_multisigned Payment.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1701,13 +1709,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Invalid field 'tx_json.Destination'."}}, +"Invalid field 'tx_json.Destination'."}}}, -{ "Missing Signers field in submit_multisigned.", +{ "Missing Signers field in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1720,13 +1728,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Missing field 'tx_json.Signers'."}}, +"Missing field 'tx_json.Signers'."}}}, -{ "Signers not an array in submit_multisigned.", +{ "Signers not an array in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1744,13 +1752,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Field 'tx_json.Signers' is not a JSON array."}}, +"Field 'tx_json.Signers' is not a JSON array."}}}, -{ "Empty Signers array in submit_multisigned.", +{ "Empty Signers array in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1765,13 +1773,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"tx_json.Signers array may not be empty."}}, +"tx_json.Signers array may not be empty."}}}, -{ "Duplicate Signer in submit_multisigned.", +{ "Duplicate Signer in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1800,13 +1808,13 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"Duplicate Signers:Signer:Account entries (rPcNzota6B8YBokhYtcTNqQVCngtbnWfux) are not allowed."}}, +"Duplicate Signers:Signer:Account entries (rPcNzota6B8YBokhYtcTNqQVCngtbnWfux) are not allowed."}}}, -{ "Signer is tx_json Account in submit_multisigned.", +{ "Signer is tx_json Account in submit_multisigned.", __LINE__, R"({ "command": "submit_multisigned", "tx_json": { @@ -1828,11 +1836,11 @@ R"({ "TransactionType": "Payment" } })", -{ +{{ "Missing field 'secret'.", "Missing field 'secret'.", "Missing field 'account'.", -"A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh)."}}, +"A Signer may not be the transaction's Account (rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh)."}}}, }; @@ -2349,7 +2357,17 @@ public: if (RPC::contains_error (result)) errStr = result["error_message"].asString (); - BEAST_EXPECT(errStr == txnTest.expMsg[get<3>(testFunc)]); + if (errStr == txnTest.expMsg[get<3>(testFunc)]) + { + pass(); + } + else + { + std::ostringstream description; + description << txnTest.description << " Called " + << get<2>(testFunc) << "()"; + fail (description.str(), __FILE__, txnTest.line); + } } } }