chore: Add clang-tidy 19 checks (#1774)

Fix #1664
This commit is contained in:
Alex Kremer
2024-12-09 16:27:53 +00:00
committed by GitHub
parent a7074dbf0f
commit 475e309f25
87 changed files with 3135 additions and 2711 deletions

View File

@@ -85,72 +85,116 @@ generateTestValuesForParametersTest()
{
return std::vector<SubscribeParamTestCaseBundle>{
SubscribeParamTestCaseBundle{
"AccountsNotArray",
R"({"accounts": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"})",
"invalidParams",
"accountsNotArray"
.testName = "AccountsNotArray",
.testJson = R"({"accounts": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"})",
.expectedError = "invalidParams",
.expectedErrorMessage = "accountsNotArray"
},
SubscribeParamTestCaseBundle{
"AccountsItemNotString", R"({"accounts": [123]})", "invalidParams", "accounts'sItemNotString"
.testName = "AccountsItemNotString",
.testJson = R"({"accounts": [123]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "accounts'sItemNotString"
},
SubscribeParamTestCaseBundle{
"AccountsItemInvalidString", R"({"accounts": ["123"]})", "actMalformed", "accounts'sItemMalformed"
.testName = "AccountsItemInvalidString",
.testJson = R"({"accounts": ["123"]})",
.expectedError = "actMalformed",
.expectedErrorMessage = "accounts'sItemMalformed"
},
SubscribeParamTestCaseBundle{
"AccountsEmptyArray", R"({"accounts": []})", "actMalformed", "accounts malformed."
.testName = "AccountsEmptyArray",
.testJson = R"({"accounts": []})",
.expectedError = "actMalformed",
.expectedErrorMessage = "accounts malformed."
},
SubscribeParamTestCaseBundle{
"AccountsProposedNotArray",
R"({"accounts_proposed": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"})",
"invalidParams",
"accounts_proposedNotArray"
.testName = "AccountsProposedNotArray",
.testJson = R"({"accounts_proposed": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"})",
.expectedError = "invalidParams",
.expectedErrorMessage = "accounts_proposedNotArray"
},
SubscribeParamTestCaseBundle{
"AccountsProposedItemNotString",
R"({"accounts_proposed": [123]})",
"invalidParams",
"accounts_proposed'sItemNotString"
.testName = "AccountsProposedItemNotString",
.testJson = R"({"accounts_proposed": [123]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "accounts_proposed'sItemNotString"
},
SubscribeParamTestCaseBundle{
"AccountsProposedItemInvalidString",
R"({"accounts_proposed": ["123"]})",
"actMalformed",
"accounts_proposed'sItemMalformed"
.testName = "AccountsProposedItemInvalidString",
.testJson = R"({"accounts_proposed": ["123"]})",
.expectedError = "actMalformed",
.expectedErrorMessage = "accounts_proposed'sItemMalformed"
},
SubscribeParamTestCaseBundle{
"AccountsProposedEmptyArray", R"({"accounts_proposed": []})", "actMalformed", "accounts_proposed malformed."
},
SubscribeParamTestCaseBundle{"StreamsNotArray", R"({"streams": 1})", "invalidParams", "streamsNotArray"},
SubscribeParamTestCaseBundle{"StreamNotString", R"({"streams": [1]})", "invalidParams", "streamNotString"},
SubscribeParamTestCaseBundle{"StreamNotValid", R"({"streams": ["1"]})", "malformedStream", "Stream malformed."},
SubscribeParamTestCaseBundle{
"StreamPeerStatusNotSupport", R"({"streams": ["peer_status"]})", "notSupported", "Operation not supported."
.testName = "AccountsProposedEmptyArray",
.testJson = R"({"accounts_proposed": []})",
.expectedError = "actMalformed",
.expectedErrorMessage = "accounts_proposed malformed."
},
SubscribeParamTestCaseBundle{
"StreamConsensusNotSupport", R"({"streams": ["consensus"]})", "notSupported", "Operation not supported."
.testName = "StreamsNotArray",
.testJson = R"({"streams": 1})",
.expectedError = "invalidParams",
.expectedErrorMessage = "streamsNotArray"
},
SubscribeParamTestCaseBundle{
"StreamServerNotSupport", R"({"streams": ["server"]})", "notSupported", "Operation not supported."
},
SubscribeParamTestCaseBundle{"BooksNotArray", R"({"books": "1"})", "invalidParams", "booksNotArray"},
SubscribeParamTestCaseBundle{
"BooksItemNotObject", R"({"books": ["1"]})", "invalidParams", "booksItemNotObject"
.testName = "StreamNotString",
.testJson = R"({"streams": [1]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "streamNotString"
},
SubscribeParamTestCaseBundle{
"BooksItemMissingTakerPays",
R"({"books": [{"taker_gets": {"currency": "XRP"}}]})",
"invalidParams",
"Missing field 'taker_pays'"
.testName = "StreamNotValid",
.testJson = R"({"streams": ["1"]})",
.expectedError = "malformedStream",
.expectedErrorMessage = "Stream malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemMissingTakerGets",
R"({"books": [{"taker_pays": {"currency": "XRP"}}]})",
"invalidParams",
"Missing field 'taker_gets'"
.testName = "StreamPeerStatusNotSupport",
.testJson = R"({"streams": ["peer_status"]})",
.expectedError = "notSupported",
.expectedErrorMessage = "Operation not supported."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsNotObject",
R"({
.testName = "StreamConsensusNotSupport",
.testJson = R"({"streams": ["consensus"]})",
.expectedError = "notSupported",
.expectedErrorMessage = "Operation not supported."
},
SubscribeParamTestCaseBundle{
.testName = "StreamServerNotSupport",
.testJson = R"({"streams": ["server"]})",
.expectedError = "notSupported",
.expectedErrorMessage = "Operation not supported."
},
SubscribeParamTestCaseBundle{
.testName = "BooksNotArray",
.testJson = R"({"books": "1"})",
.expectedError = "invalidParams",
.expectedErrorMessage = "booksNotArray"
},
SubscribeParamTestCaseBundle{
.testName = "BooksItemNotObject",
.testJson = R"({"books": ["1"]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "booksItemNotObject"
},
SubscribeParamTestCaseBundle{
.testName = "BooksItemMissingTakerPays",
.testJson = R"({"books": [{"taker_gets": {"currency": "XRP"}}]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "Missing field 'taker_pays'"
},
SubscribeParamTestCaseBundle{
.testName = "BooksItemMissingTakerGets",
.testJson = R"({"books": [{"taker_pays": {"currency": "XRP"}}]})",
.expectedError = "invalidParams",
.expectedErrorMessage = "Missing field 'taker_gets'"
},
SubscribeParamTestCaseBundle{
.testName = "BooksItemTakerGetsNotObject",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -161,12 +205,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"Field 'taker_gets' is not an object"
.expectedError = "invalidParams",
.expectedErrorMessage = "Field 'taker_gets' is not an object"
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysNotObject",
R"({
.testName = "BooksItemTakerPaysNotObject",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -177,12 +221,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"Field 'taker_pays' is not an object"
.expectedError = "invalidParams",
.expectedErrorMessage = "Field 'taker_pays' is not an object"
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysMissingCurrency",
R"({
.testName = "BooksItemTakerPaysMissingCurrency",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -193,12 +237,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcCurMalformed",
"Source currency is malformed."
.expectedError = "srcCurMalformed",
.expectedErrorMessage = "Source currency is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsMissingCurrency",
R"({
.testName = "BooksItemTakerGetsMissingCurrency",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -209,12 +253,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed."
.expectedError = "dstAmtMalformed",
.expectedErrorMessage = "Destination amount/currency/issuer is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysCurrencyNotString",
R"({
.testName = "BooksItemTakerPaysCurrencyNotString",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -228,12 +272,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcCurMalformed",
"Source currency is malformed."
.expectedError = "srcCurMalformed",
.expectedErrorMessage = "Source currency is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsCurrencyNotString",
R"({
.testName = "BooksItemTakerGetsCurrencyNotString",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -247,12 +291,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed."
.expectedError = "dstAmtMalformed",
.expectedErrorMessage = "Destination amount/currency/issuer is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysInvalidCurrency",
R"({
.testName = "BooksItemTakerPaysInvalidCurrency",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -266,12 +310,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcCurMalformed",
"Source currency is malformed."
.expectedError = "srcCurMalformed",
.expectedErrorMessage = "Source currency is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsInvalidCurrency",
R"({
.testName = "BooksItemTakerGetsInvalidCurrency",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -285,12 +329,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed."
.expectedError = "dstAmtMalformed",
.expectedErrorMessage = "Destination amount/currency/issuer is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysMissingIssuer",
R"({
.testName = "BooksItemTakerPaysMissingIssuer",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -303,12 +347,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcIsrMalformed",
"Invalid field 'taker_pays.issuer', expected non-XRP issuer."
.expectedError = "srcIsrMalformed",
.expectedErrorMessage = "Invalid field 'taker_pays.issuer', expected non-XRP issuer."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsMissingIssuer",
R"({
.testName = "BooksItemTakerGetsMissingIssuer",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -321,12 +365,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstIsrMalformed",
"Invalid field 'taker_gets.issuer', expected non-XRP issuer."
.expectedError = "dstIsrMalformed",
.expectedErrorMessage = "Invalid field 'taker_gets.issuer', expected non-XRP issuer."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysIssuerNotString",
R"({
.testName = "BooksItemTakerPaysIssuerNotString",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -340,12 +384,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"takerPaysIssuerNotString"
.expectedError = "invalidParams",
.expectedErrorMessage = "takerPaysIssuerNotString"
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsIssuerNotString",
R"({
.testName = "BooksItemTakerGetsIssuerNotString",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -359,12 +403,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"taker_gets.issuer should be string"
.expectedError = "invalidParams",
.expectedErrorMessage = "taker_gets.issuer should be string"
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysInvalidIssuer",
R"({
.testName = "BooksItemTakerPaysInvalidIssuer",
.testJson = R"({
"books": [
{
"taker_gets":
@@ -378,12 +422,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcIsrMalformed",
"Source issuer is malformed."
.expectedError = "srcIsrMalformed",
.expectedErrorMessage = "Source issuer is malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsInvalidIssuer",
R"({
.testName = "BooksItemTakerGetsInvalidIssuer",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -397,12 +441,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstIsrMalformed",
"Invalid field 'taker_gets.issuer', bad issuer."
.expectedError = "dstIsrMalformed",
.expectedErrorMessage = "Invalid field 'taker_gets.issuer', bad issuer."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerGetsXRPHasIssuer",
R"({
.testName = "BooksItemTakerGetsXRPHasIssuer",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -417,12 +461,12 @@ generateTestValuesForParametersTest()
}
]
})",
"dstIsrMalformed",
"Unneeded field 'taker_gets.issuer' for XRP currency specification."
.expectedError = "dstIsrMalformed",
.expectedErrorMessage = "Unneeded field 'taker_gets.issuer' for XRP currency specification."
},
SubscribeParamTestCaseBundle{
"BooksItemTakerPaysXRPHasIssuer",
R"({
.testName = "BooksItemTakerPaysXRPHasIssuer",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -437,12 +481,12 @@ generateTestValuesForParametersTest()
}
]
})",
"srcIsrMalformed",
"Unneeded field 'taker_pays.issuer' for XRP currency specification."
.expectedError = "srcIsrMalformed",
.expectedErrorMessage = "Unneeded field 'taker_pays.issuer' for XRP currency specification."
},
SubscribeParamTestCaseBundle{
"BooksItemBadMartket",
R"({
.testName = "BooksItemBadMartket",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -455,12 +499,12 @@ generateTestValuesForParametersTest()
}
]
})",
"badMarket",
"badMarket"
.expectedError = "badMarket",
.expectedErrorMessage = "badMarket"
},
SubscribeParamTestCaseBundle{
"BooksItemInvalidSnapshot",
R"({
.testName = "BooksItemInvalidSnapshot",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -475,12 +519,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"snapshotNotBool"
.expectedError = "invalidParams",
.expectedErrorMessage = "snapshotNotBool"
},
SubscribeParamTestCaseBundle{
"BooksItemInvalidBoth",
R"({
.testName = "BooksItemInvalidBoth",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -495,12 +539,12 @@ generateTestValuesForParametersTest()
}
]
})",
"invalidParams",
"bothNotBool"
.expectedError = "invalidParams",
.expectedErrorMessage = "bothNotBool"
},
SubscribeParamTestCaseBundle{
"BooksItemInvalidTakerNotString",
R"({
.testName = "BooksItemInvalidTakerNotString",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -515,12 +559,12 @@ generateTestValuesForParametersTest()
}
]
})",
"badIssuer",
"Issuer account malformed."
.expectedError = "badIssuer",
.expectedErrorMessage = "Issuer account malformed."
},
SubscribeParamTestCaseBundle{
"BooksItemInvalidTaker",
R"({
.testName = "BooksItemInvalidTaker",
.testJson = R"({
"books": [
{
"taker_pays":
@@ -535,8 +579,8 @@ generateTestValuesForParametersTest()
}
]
})",
"badIssuer",
"Issuer account malformed."
.expectedError = "badIssuer",
.expectedErrorMessage = "Issuer account malformed."
},
};
}