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

@@ -84,108 +84,150 @@ generateTestValuesForParametersTest()
auto const shouldForward = true;
return std::vector<ShouldForwardParamTestCaseBundle>{
{"ShouldForwardReturnsFalseIfClioOnly", 2u, "test", "{}", isClioOnly, 1, !isAdmin, !shouldForward},
{"ShouldForwardReturnsTrueIfProxied", 2u, "submit", "{}", !isClioOnly, 1, !isAdmin, shouldForward},
{"ShouldForwardReturnsTrueIfCurrentLedgerSpecified",
2u,
"anymethod",
R"({"ledger_index": "current"})",
!isClioOnly,
1,
!isAdmin,
shouldForward},
{"ShouldForwardReturnsTrueIfClosedLedgerSpecified",
2u,
"anymethod",
R"({"ledger_index": "closed"})",
!isClioOnly,
1,
!isAdmin,
shouldForward},
{"ShouldForwardReturnsTrueIfAccountInfoWithQueueSpecified",
2u,
"account_info",
R"({"queue": true})",
!isClioOnly,
1,
!isAdmin,
shouldForward},
{"ShouldForwardReturnsFalseIfAccountInfoQueueIsFalse",
2u,
"account_info",
R"({"queue": false})",
!isClioOnly,
1,
!isAdmin,
!shouldForward},
{"ShouldForwardReturnsTrueIfLedgerWithQueueSpecified",
2u,
"ledger",
R"({"queue": true})",
!isClioOnly,
1,
!isAdmin,
shouldForward},
{"ShouldForwardReturnsFalseIfLedgerQueueIsFalse",
2u,
"ledger",
R"({"queue": false})",
!isClioOnly,
1,
!isAdmin,
!shouldForward},
{"ShouldNotForwardReturnsTrueIfAPIVersionIsV1",
1u,
"api_version_check",
"{}",
!isClioOnly,
1,
!isAdmin,
!shouldForward},
{"ShouldForwardReturnsFalseIfAPIVersionIsV2",
2u,
"api_version_check",
"{}",
!isClioOnly,
1,
!isAdmin,
!shouldForward},
{"ShouldNeverForwardSubscribe", 1u, "subscribe", "{}", !isClioOnly, 0, !isAdmin, !shouldForward},
{"ShouldNeverForwardUnsubscribe", 1u, "unsubscribe", "{}", !isClioOnly, 0, !isAdmin, !shouldForward},
{"ForceForwardTrue", 1u, "any_method", R"({"force_forward": true})", !isClioOnly, 1, isAdmin, shouldForward},
{"ForceForwardFalse", 1u, "any_method", R"({"force_forward": false})", !isClioOnly, 1, isAdmin, !shouldForward},
{"ForceForwardNotAdmin",
1u,
"any_method",
R"({"force_forward": true})",
!isClioOnly,
1,
!isAdmin,
!shouldForward},
{"ForceForwardSubscribe",
1u,
"subscribe",
R"({"force_forward": true})",
!isClioOnly,
0,
isAdmin,
not shouldForward},
{"ForceForwardUnsubscribe",
1u,
"unsubscribe",
R"({"force_forward": true})",
!isClioOnly,
0,
isAdmin,
!shouldForward},
{"ForceForwardClioOnly",
1u,
"clio_only_method",
R"({"force_forward": true})",
isClioOnly,
1,
isAdmin,
!shouldForward},
{.testName = "ShouldForwardReturnsFalseIfClioOnly",
.apiVersion = 2u,
.method = "test",
.testJson = "{}",
.mockedIsClioOnly = isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldForwardReturnsTrueIfProxied",
.apiVersion = 2u,
.method = "submit",
.testJson = "{}",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = shouldForward},
{.testName = "ShouldForwardReturnsTrueIfCurrentLedgerSpecified",
.apiVersion = 2u,
.method = "anymethod",
.testJson = R"({"ledger_index": "current"})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = shouldForward},
{.testName = "ShouldForwardReturnsTrueIfClosedLedgerSpecified",
.apiVersion = 2u,
.method = "anymethod",
.testJson = R"({"ledger_index": "closed"})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = shouldForward},
{.testName = "ShouldForwardReturnsTrueIfAccountInfoWithQueueSpecified",
.apiVersion = 2u,
.method = "account_info",
.testJson = R"({"queue": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = shouldForward},
{.testName = "ShouldForwardReturnsFalseIfAccountInfoQueueIsFalse",
.apiVersion = 2u,
.method = "account_info",
.testJson = R"({"queue": false})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldForwardReturnsTrueIfLedgerWithQueueSpecified",
.apiVersion = 2u,
.method = "ledger",
.testJson = R"({"queue": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = shouldForward},
{.testName = "ShouldForwardReturnsFalseIfLedgerQueueIsFalse",
.apiVersion = 2u,
.method = "ledger",
.testJson = R"({"queue": false})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldNotForwardReturnsTrueIfAPIVersionIsV1",
.apiVersion = 1u,
.method = "api_version_check",
.testJson = "{}",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldForwardReturnsFalseIfAPIVersionIsV2",
.apiVersion = 2u,
.method = "api_version_check",
.testJson = "{}",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldNeverForwardSubscribe",
.apiVersion = 1u,
.method = "subscribe",
.testJson = "{}",
.mockedIsClioOnly = !isClioOnly,
.called = 0,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ShouldNeverForwardUnsubscribe",
.apiVersion = 1u,
.method = "unsubscribe",
.testJson = "{}",
.mockedIsClioOnly = !isClioOnly,
.called = 0,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ForceForwardTrue",
.apiVersion = 1u,
.method = "any_method",
.testJson = R"({"force_forward": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = isAdmin,
.expected = shouldForward},
{.testName = "ForceForwardFalse",
.apiVersion = 1u,
.method = "any_method",
.testJson = R"({"force_forward": false})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = isAdmin,
.expected = !shouldForward},
{.testName = "ForceForwardNotAdmin",
.apiVersion = 1u,
.method = "any_method",
.testJson = R"({"force_forward": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 1,
.isAdmin = !isAdmin,
.expected = !shouldForward},
{.testName = "ForceForwardSubscribe",
.apiVersion = 1u,
.method = "subscribe",
.testJson = R"({"force_forward": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 0,
.isAdmin = isAdmin,
.expected = not shouldForward},
{.testName = "ForceForwardUnsubscribe",
.apiVersion = 1u,
.method = "unsubscribe",
.testJson = R"({"force_forward": true})",
.mockedIsClioOnly = !isClioOnly,
.called = 0,
.isAdmin = isAdmin,
.expected = !shouldForward},
{.testName = "ForceForwardClioOnly",
.apiVersion = 1u,
.method = "clio_only_method",
.testJson = R"({"force_forward": true})",
.mockedIsClioOnly = isClioOnly,
.called = 1,
.isAdmin = isAdmin,
.expected = !shouldForward},
};
}