style: Fix pre-commit style issues (#2743)

This commit is contained in:
Ayaz Salikhov
2025-10-30 14:04:15 +00:00
committed by GitHub
parent cecf082952
commit 30e88fe72c
2 changed files with 100 additions and 88 deletions

View File

@@ -138,48 +138,54 @@ static auto
generateTestValuesForInvalidParamsTest() generateTestValuesForInvalidParamsTest()
{ {
return std::vector<AccountMPTokenIssuancesParamTestCaseBundle>{ return std::vector<AccountMPTokenIssuancesParamTestCaseBundle>{
{.testName="NonHexLedgerHash", {.testName = "NonHexLedgerHash",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_hash": "xxx" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_hash": "xxx" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledger_hashMalformed"}, .expectedErrorMessage = "ledger_hashMalformed"},
{.testName="NonStringLedgerHash", {.testName = "NonStringLedgerHash",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_hash": 123 }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_hash": 123 }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledger_hashNotString"}, .expectedErrorMessage = "ledger_hashNotString"},
{.testName="InvalidLedgerIndexString", {.testName = "InvalidLedgerIndexString",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_index": "notvalidated" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_index": "notvalidated" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledgerIndexMalformed"}, .expectedErrorMessage = "ledgerIndexMalformed"},
{.testName="MarkerNotString", {.testName = "MarkerNotString",
.testJson=fmt::format(R"JSON({{ "account": "{}", "marker": 9 }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "marker": 9 }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="markerNotString"}, .expectedErrorMessage = "markerNotString"},
{.testName="InvalidMarkerContent", {.testName = "InvalidMarkerContent",
.testJson=fmt::format(R"JSON({{ "account": "{}", "marker": "123invalid" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "marker": "123invalid" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="Malformed cursor."}, .expectedErrorMessage = "Malformed cursor."},
{.testName="AccountMissing", .testJson=R"JSON({ "limit": 10 })JSON", .expectedError="invalidParams", .expectedErrorMessage="Required field 'account' missing"}, {.testName = "AccountMissing",
{.testName="AccountNotString", .testJson=R"JSON({ "account": 123 })JSON", .expectedError="actMalformed", .expectedErrorMessage="Account malformed."}, .testJson = R"JSON({ "limit": 10 })JSON",
{.testName="AccountMalformed", .expectedError = "invalidParams",
.testJson=R"JSON({ "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jp" })JSON", .expectedErrorMessage = "Required field 'account' missing"},
.expectedError="actMalformed", {.testName = "AccountNotString",
.expectedErrorMessage="Account malformed."}, .testJson = R"JSON({ "account": 123 })JSON",
{.testName="LimitNotInteger", .expectedError = "actMalformed",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": "t" }})JSON", kACCOUNT), .expectedErrorMessage = "Account malformed."},
.expectedError="invalidParams", {.testName = "AccountMalformed",
.expectedErrorMessage="Invalid parameters."}, .testJson = R"JSON({ "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jp" })JSON",
{.testName="LimitNegative", .expectedError = "actMalformed",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": -1 }})JSON", kACCOUNT), .expectedErrorMessage = "Account malformed."},
.expectedError="invalidParams", {.testName = "LimitNotInteger",
.expectedErrorMessage="Invalid parameters."}, .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": "t" }})JSON", kACCOUNT),
{.testName="LimitZero", .expectedError = "invalidParams",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": 0 }})JSON", kACCOUNT), .expectedErrorMessage = "Invalid parameters."},
.expectedError="invalidParams", {.testName = "LimitNegative",
.expectedErrorMessage="Invalid parameters."}, .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": -1 }})JSON", kACCOUNT),
{.testName="LimitTypeInvalid", .expectedError = "invalidParams",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": true }})JSON", kACCOUNT), .expectedErrorMessage = "Invalid parameters."},
.expectedError="invalidParams", {.testName = "LimitZero",
.expectedErrorMessage="Invalid parameters."} .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": 0 }})JSON", kACCOUNT),
.expectedError = "invalidParams",
.expectedErrorMessage = "Invalid parameters."},
{.testName = "LimitTypeInvalid",
.testJson = fmt::format(R"JSON({{ "account": "{}", "limit": true }})JSON", kACCOUNT),
.expectedError = "invalidParams",
.expectedErrorMessage = "Invalid parameters."}
}; };
} }
@@ -537,13 +543,13 @@ TEST_F(RPCAccountMPTokenIssuancesHandlerTest, MarkerOutput)
std::vector<ripple::uint256> indexes; std::vector<ripple::uint256> indexes;
indexes.reserve(10); indexes.reserve(10);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
indexes.emplace_back(kISSUANCE_INDEX1); indexes.emplace_back(kISSUANCE_INDEX1);
} }
std::vector<Blob> bbs; std::vector<Blob> bbs;
bbs.reserve(kLIMIT); bbs.reserve(kLIMIT);
for (int i = 0; i < kLIMIT; ++i) { for (int i = 0; i < kLIMIT; ++i) {
bbs.push_back(createMptIssuanceObject(kACCOUNT, i).getSerializer().peekData()); bbs.push_back(createMptIssuanceObject(kACCOUNT, i).getSerializer().peekData());
} }
EXPECT_CALL(*backend_, doFetchLedgerObjects).WillOnce(Return(bbs)); EXPECT_CALL(*backend_, doFetchLedgerObjects).WillOnce(Return(bbs));

View File

@@ -112,48 +112,54 @@ static auto
generateTestValuesForInvalidParamsTest() generateTestValuesForInvalidParamsTest()
{ {
return std::vector<AccountMPTokensParamTestCaseBundle>{ return std::vector<AccountMPTokensParamTestCaseBundle>{
{.testName="NonHexLedgerHash", {.testName = "NonHexLedgerHash",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_hash": "xxx" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_hash": "xxx" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledger_hashMalformed"}, .expectedErrorMessage = "ledger_hashMalformed"},
{.testName="NonStringLedgerHash", {.testName = "NonStringLedgerHash",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_hash": 123 }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_hash": 123 }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledger_hashNotString"}, .expectedErrorMessage = "ledger_hashNotString"},
{.testName="InvalidLedgerIndexString", {.testName = "InvalidLedgerIndexString",
.testJson=fmt::format(R"JSON({{ "account": "{}", "ledger_index": "notvalidated" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "ledger_index": "notvalidated" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="ledgerIndexMalformed"}, .expectedErrorMessage = "ledgerIndexMalformed"},
{.testName="MarkerNotString", {.testName = "MarkerNotString",
.testJson=fmt::format(R"JSON({{ "account": "{}", "marker": 9 }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "marker": 9 }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="markerNotString"}, .expectedErrorMessage = "markerNotString"},
{.testName="InvalidMarkerContent", {.testName = "InvalidMarkerContent",
.testJson=fmt::format(R"JSON({{ "account": "{}", "marker": "123invalid" }})JSON", kACCOUNT), .testJson = fmt::format(R"JSON({{ "account": "{}", "marker": "123invalid" }})JSON", kACCOUNT),
.expectedError="invalidParams", .expectedError = "invalidParams",
.expectedErrorMessage="Malformed cursor."}, .expectedErrorMessage = "Malformed cursor."},
{.testName="AccountMissing", .testJson=R"JSON({ "limit": 10 })JSON", .expectedError="invalidParams", .expectedErrorMessage="Required field 'account' missing"}, {.testName = "AccountMissing",
{.testName="AccountNotString", .testJson=R"JSON({ "account": 123 })JSON", .expectedError="actMalformed", .expectedErrorMessage="Account malformed."}, .testJson = R"JSON({ "limit": 10 })JSON",
{.testName="AccountMalformed", .expectedError = "invalidParams",
.testJson=fmt::format(R"JSON({{ "account": "{}" }})JSON", "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jp"), .expectedErrorMessage = "Required field 'account' missing"},
.expectedError="actMalformed", {.testName = "AccountNotString",
.expectedErrorMessage="Account malformed."}, .testJson = R"JSON({ "account": 123 })JSON",
{.testName="LimitNotInteger", .expectedError = "actMalformed",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": "t" }})JSON", kACCOUNT), .expectedErrorMessage = "Account malformed."},
.expectedError="invalidParams", {.testName = "AccountMalformed",
.expectedErrorMessage="Invalid parameters."}, .testJson = fmt::format(R"JSON({{ "account": "{}" }})JSON", "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jp"),
{.testName="LimitNegative", .expectedError = "actMalformed",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": -1 }})JSON", kACCOUNT), .expectedErrorMessage = "Account malformed."},
.expectedError="invalidParams", {.testName = "LimitNotInteger",
.expectedErrorMessage="Invalid parameters."}, .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": "t" }})JSON", kACCOUNT),
{.testName="LimitZero", .expectedError = "invalidParams",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": 0 }})JSON", kACCOUNT), .expectedErrorMessage = "Invalid parameters."},
.expectedError="invalidParams", {.testName = "LimitNegative",
.expectedErrorMessage="Invalid parameters."}, .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": -1 }})JSON", kACCOUNT),
{.testName="LimitTypeInvalid", .expectedError = "invalidParams",
.testJson=fmt::format(R"JSON({{ "account": "{}", "limit": true }})JSON", kACCOUNT), .expectedErrorMessage = "Invalid parameters."},
.expectedError="invalidParams", {.testName = "LimitZero",
.expectedErrorMessage="Invalid parameters."} .testJson = fmt::format(R"JSON({{ "account": "{}", "limit": 0 }})JSON", kACCOUNT),
.expectedError = "invalidParams",
.expectedErrorMessage = "Invalid parameters."},
{.testName = "LimitTypeInvalid",
.testJson = fmt::format(R"JSON({{ "account": "{}", "limit": true }})JSON", kACCOUNT),
.expectedError = "invalidParams",
.expectedErrorMessage = "Invalid parameters."}
}; };
} }
@@ -488,7 +494,7 @@ TEST_F(RPCAccountMPTokensHandlerTest, MarkerOutput)
std::vector<Blob> bbs; std::vector<Blob> bbs;
bbs.reserve(kLIMIT); bbs.reserve(kLIMIT);
for (int i = 0; i < kLIMIT; ++i) { for (int i = 0; i < kLIMIT; ++i) {
bbs.push_back(createMpTokenObject(kACCOUNT, ripple::uint192(kISSUANCE_ID_HEX), i, 0, std::nullopt) bbs.push_back(createMpTokenObject(kACCOUNT, ripple::uint192(kISSUANCE_ID_HEX), i, 0, std::nullopt)
.getSerializer() .getSerializer()
.peekData()); .peekData());
@@ -497,7 +503,7 @@ for (int i = 0; i < kLIMIT; ++i) {
std::vector<ripple::uint256> indexes1; std::vector<ripple::uint256> indexes1;
indexes1.reserve(10); indexes1.reserve(10);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
indexes1.emplace_back(kTOKEN_INDEX1); indexes1.emplace_back(kTOKEN_INDEX1);
} }
ripple::STObject ownerDir1 = createOwnerDirLedgerObject(indexes1, kTOKEN_INDEX1); ripple::STObject ownerDir1 = createOwnerDirLedgerObject(indexes1, kTOKEN_INDEX1);