chore: Enable clang-tidy misc checks (#6655)

This commit is contained in:
Alex Kremer
2026-03-31 18:29:45 +01:00
committed by Bart
parent 7315c57edc
commit 2dc705bd99
469 changed files with 3915 additions and 3965 deletions

View File

@@ -23,7 +23,7 @@ class Hooks_test : public beast::unit_test::suite
using namespace test::jtx;
std::vector<std::reference_wrapper<SField const>> fields_to_test = {
std::vector<std::reference_wrapper<SField const>> const fields_to_test = {
sfHookResult,
sfHookStateChangeCount,
sfHookEmitCount,
@@ -116,7 +116,7 @@ class Hooks_test : public beast::unit_test::suite
}
case STI_UINT256: {
uint256 u = uint256::fromVoid(
uint256 const u = uint256::fromVoid(
"DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBE"
"EFDEADBEEF");
dummy.setFieldH256(f, u);
@@ -126,7 +126,7 @@ class Hooks_test : public beast::unit_test::suite
}
case STI_VL: {
std::vector<uint8_t> v{1, 2, 3};
std::vector<uint8_t> const v{1, 2, 3};
dummy.setFieldVL(f, v);
BEAST_EXPECT(dummy.getFieldVL(f) == v);
BEAST_EXPECT(dummy.isFieldPresent(f));
@@ -135,7 +135,8 @@ class Hooks_test : public beast::unit_test::suite
case STI_ACCOUNT: {
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
AccountID id = *parseBase58<AccountID>("rwfSjJNK2YQuN64bSWn7T2eY9FJAyAPYJT");
AccountID const id =
*parseBase58<AccountID>("rwfSjJNK2YQuN64bSWn7T2eY9FJAyAPYJT");
dummy.setAccountID(f, id);
BEAST_EXPECT(dummy.getAccountID(f) == id);
BEAST_EXPECT(dummy.isFieldPresent(f));

View File

@@ -155,7 +155,7 @@ public:
using namespace InnerObjectFormatsUnitTestDetail;
// Instantiate a jtx::Env so debugLog writes are exercised.
test::jtx::Env env(*this);
test::jtx::Env const env(*this);
for (auto const& test : testArray)
{
@@ -166,7 +166,7 @@ public:
Throw<std::runtime_error>(
"Internal InnerObjectFormatsParsedJSON error. Bad JSON.");
}
STParsedJSONObject parsed("request", req);
STParsedJSONObject const parsed("request", req);
bool const noObj = !parsed.object.has_value();
if (noObj == test.expectFail)
{

View File

@@ -42,7 +42,7 @@ public:
BEAST_EXPECT(u3 >= u2);
BEAST_EXPECT(u3 > u2);
std::hash<Unsigned> hash;
std::hash<Unsigned> const hash;
BEAST_EXPECT(hash(u1) == hash(u1));
BEAST_EXPECT(hash(u2) == hash(u2));
@@ -83,7 +83,7 @@ public:
BEAST_EXPECT(Issue(c1, i3) >= Issue(c1, i2));
BEAST_EXPECT(Issue(c1, i3) > Issue(c1, i2));
std::hash<Issue> hash;
std::hash<Issue> const hash;
BEAST_EXPECT(hash(Issue(c1, i1)) == hash(Issue(c1, i1)));
BEAST_EXPECT(hash(Issue(c1, i2)) == hash(Issue(c1, i2)));
@@ -394,10 +394,10 @@ public:
Currency const c3(3);
AccountID const i3(3);
Issue a1(c1, i1);
Issue a2(c1, i2);
Issue a3(c2, i2);
Issue a4(c3, i2);
Issue const a1(c1, i1);
Issue const a2(c1, i2);
Issue const a3(c2, i2);
Issue const a4(c3, i2);
uint256 const domain1{1};
uint256 const domain2{2};
@@ -477,7 +477,7 @@ public:
BEAST_EXPECT(Book(a3, a4, domain2) > Book(a2, a3, domain1));
}
std::hash<Book> hash;
std::hash<Book> const hash;
// log << std::hex << hash (Book (a1, a2));
// log << std::hex << hash (Book (a1, a2));

View File

@@ -304,7 +304,7 @@ public:
auto s = good;
// Remove all characters from the string in random order:
std::hash<std::string> r;
std::hash<std::string> const r;
while (!s.empty())
{
@@ -421,7 +421,7 @@ public:
KeyType::secp256k1,
generateSecretKey(KeyType::secp256k1, generateSeed("masterpassphrase")));
PublicKey pk2(pk1);
PublicKey const pk2(pk1);
BEAST_EXPECT(pk1 == pk2);
BEAST_EXPECT(pk2 == pk1);

View File

@@ -66,7 +66,7 @@ public:
{
// 1 in, 1 out:
Quality q(Amounts(amount(1), amount(1)));
Quality const q(Amounts(amount(1), amount(1)));
ceil_in(
q,
@@ -95,7 +95,7 @@ public:
{
// 1 in, 2 out:
Quality q(Amounts(amount(1), amount(2)));
Quality const q(Amounts(amount(1), amount(2)));
ceil_in(
q,
@@ -124,7 +124,7 @@ public:
{
// 2 in, 1 out:
Quality q(Amounts(amount(2), amount(1)));
Quality const q(Amounts(amount(2), amount(1)));
ceil_in(
q,
@@ -159,7 +159,7 @@ public:
{
// 1 in, 1 out:
Quality q(Amounts(amount(1), amount(1)));
Quality const q(Amounts(amount(1), amount(1)));
ceil_out(
q,
@@ -188,7 +188,7 @@ public:
{
// 1 in, 2 out:
Quality q(Amounts(amount(1), amount(2)));
Quality const q(Amounts(amount(1), amount(2)));
ceil_out(
q,
@@ -217,7 +217,7 @@ public:
{
// 2 in, 1 out:
Quality q(Amounts(amount(2), amount(1)));
Quality const q(Amounts(amount(2), amount(1)));
ceil_out(
q,
@@ -251,7 +251,7 @@ public:
testcase("raw");
{
Quality q(0x5d048191fb9130daull); // 126836389.7680090
Quality const q(0x5d048191fb9130daull); // 126836389.7680090
Amounts const value(
amount(349469768), // 349.469768 XRP
raw(2755280000000000ull, -15)); // 2.75528
@@ -266,7 +266,7 @@ public:
{
testcase("round");
Quality q(0x59148191fb913522ull); // 57719.63525051682
Quality const q(0x59148191fb913522ull); // 57719.63525051682
BEAST_EXPECT(q.round(3).rate().getText() == "57800");
BEAST_EXPECT(q.round(4).rate().getText() == "57720");
BEAST_EXPECT(q.round(5).rate().getText() == "57720");

View File

@@ -28,7 +28,7 @@ public:
return amount;
std::uint64_t mantissa = amount.mantissa();
std::uint64_t valueDigits = mantissa % 1000000000;
std::uint64_t const valueDigits = mantissa % 1000000000;
if (valueDigits == 1)
{
@@ -67,15 +67,15 @@ public:
roundTest(int n, int d, int m)
{
// check STAmount rounding
STAmount num(noIssue(), n);
STAmount den(noIssue(), d);
STAmount mul(noIssue(), m);
STAmount quot = divide(STAmount(n), STAmount(d), noIssue());
STAmount res = roundSelf(multiply(quot, mul, noIssue()));
STAmount const num(noIssue(), n);
STAmount const den(noIssue(), d);
STAmount const mul(noIssue(), m);
STAmount const quot = divide(STAmount(n), STAmount(d), noIssue());
STAmount const res = roundSelf(multiply(quot, mul, noIssue()));
BEAST_EXPECT(!res.native());
STAmount cmp(noIssue(), (n * m) / d);
STAmount const cmp(noIssue(), (n * m) / d);
BEAST_EXPECT(!cmp.native());
@@ -93,13 +93,14 @@ public:
void
mulTest(int a, int b)
{
STAmount aa(noIssue(), a);
STAmount bb(noIssue(), b);
STAmount prod1(multiply(aa, bb, noIssue()));
STAmount const aa(noIssue(), a);
STAmount const bb(noIssue(), b);
STAmount const prod1(multiply(aa, bb, noIssue()));
BEAST_EXPECT(!prod1.native());
STAmount prod2(noIssue(), static_cast<std::uint64_t>(a) * static_cast<std::uint64_t>(b));
STAmount const prod2(
noIssue(), static_cast<std::uint64_t>(a) * static_cast<std::uint64_t>(b));
if (prod1 != prod2)
{
@@ -196,7 +197,11 @@ public:
testNativeCurrency()
{
testcase("native currency");
STAmount zeroSt, one(1), hundred(100);
STAmount const zeroSt;
STAmount const one(1);
STAmount const hundred(100);
// VFALCO NOTE Why repeat "STAmount fail" so many times??
unexpected(serializeAndDeserialize(zeroSt) != zeroSt, "STAmount fail");
unexpected(serializeAndDeserialize(one) != one, "STAmount fail");
@@ -206,60 +211,60 @@ public:
unexpected(zeroSt != beast::zero, "STAmount fail");
unexpected(one == beast::zero, "STAmount fail");
unexpected(hundred == beast::zero, "STAmount fail");
unexpected((zeroSt < zeroSt), "STAmount fail");
unexpected((zeroSt < zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt < one), "STAmount fail");
unexpected(!(zeroSt < hundred), "STAmount fail");
unexpected((one < zeroSt), "STAmount fail");
unexpected((one < one), "STAmount fail");
unexpected((one < one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one < hundred), "STAmount fail");
unexpected((hundred < zeroSt), "STAmount fail");
unexpected((hundred < one), "STAmount fail");
unexpected((hundred < hundred), "STAmount fail");
unexpected((zeroSt > zeroSt), "STAmount fail");
unexpected((hundred < hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt > zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt > one), "STAmount fail");
unexpected((zeroSt > hundred), "STAmount fail");
unexpected(!(one > zeroSt), "STAmount fail");
unexpected((one > one), "STAmount fail");
unexpected((one > one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one > hundred), "STAmount fail");
unexpected(!(hundred > zeroSt), "STAmount fail");
unexpected(!(hundred > one), "STAmount fail");
unexpected((hundred > hundred), "STAmount fail");
unexpected(!(zeroSt <= zeroSt), "STAmount fail");
unexpected((hundred > hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt <= zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt <= one), "STAmount fail");
unexpected(!(zeroSt <= hundred), "STAmount fail");
unexpected((one <= zeroSt), "STAmount fail");
unexpected(!(one <= one), "STAmount fail");
unexpected(!(one <= one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one <= hundred), "STAmount fail");
unexpected((hundred <= zeroSt), "STAmount fail");
unexpected((hundred <= one), "STAmount fail");
unexpected(!(hundred <= hundred), "STAmount fail");
unexpected(!(zeroSt >= zeroSt), "STAmount fail");
unexpected(!(hundred <= hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt >= zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt >= one), "STAmount fail");
unexpected((zeroSt >= hundred), "STAmount fail");
unexpected(!(one >= zeroSt), "STAmount fail");
unexpected(!(one >= one), "STAmount fail");
unexpected(!(one >= one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one >= hundred), "STAmount fail");
unexpected(!(hundred >= zeroSt), "STAmount fail");
unexpected(!(hundred >= one), "STAmount fail");
unexpected(!(hundred >= hundred), "STAmount fail");
unexpected(!(zeroSt == zeroSt), "STAmount fail");
unexpected(!(hundred >= hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt == zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt == one), "STAmount fail");
unexpected((zeroSt == hundred), "STAmount fail");
unexpected((one == zeroSt), "STAmount fail");
unexpected(!(one == one), "STAmount fail");
unexpected(!(one == one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one == hundred), "STAmount fail");
unexpected((hundred == zeroSt), "STAmount fail");
unexpected((hundred == one), "STAmount fail");
unexpected(!(hundred == hundred), "STAmount fail");
unexpected((zeroSt != zeroSt), "STAmount fail");
unexpected(!(hundred == hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt != zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt != one), "STAmount fail");
unexpected(!(zeroSt != hundred), "STAmount fail");
unexpected(!(one != zeroSt), "STAmount fail");
unexpected((one != one), "STAmount fail");
unexpected((one != one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one != hundred), "STAmount fail");
unexpected(!(hundred != zeroSt), "STAmount fail");
unexpected(!(hundred != one), "STAmount fail");
unexpected((hundred != hundred), "STAmount fail");
unexpected((hundred != hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(STAmount().getText() != "0", "STAmount fail");
unexpected(STAmount(31).getText() != "31", "STAmount fail");
unexpected(STAmount(310).getText() != "310", "STAmount fail");
@@ -279,7 +284,11 @@ public:
testCustomCurrency()
{
testcase("custom currency");
STAmount zeroSt(noIssue()), one(noIssue(), 1), hundred(noIssue(), 100);
STAmount const zeroSt(noIssue());
STAmount const one(noIssue(), 1);
STAmount const hundred(noIssue(), 100);
unexpected(serializeAndDeserialize(zeroSt) != zeroSt, "STAmount fail");
unexpected(serializeAndDeserialize(one) != one, "STAmount fail");
unexpected(serializeAndDeserialize(hundred) != hundred, "STAmount fail");
@@ -288,60 +297,60 @@ public:
unexpected(zeroSt != beast::zero, "STAmount fail");
unexpected(one == beast::zero, "STAmount fail");
unexpected(hundred == beast::zero, "STAmount fail");
unexpected((zeroSt < zeroSt), "STAmount fail");
unexpected((zeroSt < zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt < one), "STAmount fail");
unexpected(!(zeroSt < hundred), "STAmount fail");
unexpected((one < zeroSt), "STAmount fail");
unexpected((one < one), "STAmount fail");
unexpected((one < one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one < hundred), "STAmount fail");
unexpected((hundred < zeroSt), "STAmount fail");
unexpected((hundred < one), "STAmount fail");
unexpected((hundred < hundred), "STAmount fail");
unexpected((zeroSt > zeroSt), "STAmount fail");
unexpected((hundred < hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt > zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt > one), "STAmount fail");
unexpected((zeroSt > hundred), "STAmount fail");
unexpected(!(one > zeroSt), "STAmount fail");
unexpected((one > one), "STAmount fail");
unexpected((one > one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one > hundred), "STAmount fail");
unexpected(!(hundred > zeroSt), "STAmount fail");
unexpected(!(hundred > one), "STAmount fail");
unexpected((hundred > hundred), "STAmount fail");
unexpected(!(zeroSt <= zeroSt), "STAmount fail");
unexpected((hundred > hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt <= zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt <= one), "STAmount fail");
unexpected(!(zeroSt <= hundred), "STAmount fail");
unexpected((one <= zeroSt), "STAmount fail");
unexpected(!(one <= one), "STAmount fail");
unexpected(!(one <= one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one <= hundred), "STAmount fail");
unexpected((hundred <= zeroSt), "STAmount fail");
unexpected((hundred <= one), "STAmount fail");
unexpected(!(hundred <= hundred), "STAmount fail");
unexpected(!(zeroSt >= zeroSt), "STAmount fail");
unexpected(!(hundred <= hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt >= zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt >= one), "STAmount fail");
unexpected((zeroSt >= hundred), "STAmount fail");
unexpected(!(one >= zeroSt), "STAmount fail");
unexpected(!(one >= one), "STAmount fail");
unexpected(!(one >= one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one >= hundred), "STAmount fail");
unexpected(!(hundred >= zeroSt), "STAmount fail");
unexpected(!(hundred >= one), "STAmount fail");
unexpected(!(hundred >= hundred), "STAmount fail");
unexpected(!(zeroSt == zeroSt), "STAmount fail");
unexpected(!(hundred >= hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt == zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt == one), "STAmount fail");
unexpected((zeroSt == hundred), "STAmount fail");
unexpected((one == zeroSt), "STAmount fail");
unexpected(!(one == one), "STAmount fail");
unexpected(!(one == one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((one == hundred), "STAmount fail");
unexpected((hundred == zeroSt), "STAmount fail");
unexpected((hundred == one), "STAmount fail");
unexpected(!(hundred == hundred), "STAmount fail");
unexpected((zeroSt != zeroSt), "STAmount fail");
unexpected(!(hundred == hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected((zeroSt != zeroSt), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(zeroSt != one), "STAmount fail");
unexpected(!(zeroSt != hundred), "STAmount fail");
unexpected(!(one != zeroSt), "STAmount fail");
unexpected((one != one), "STAmount fail");
unexpected((one != one), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(!(one != hundred), "STAmount fail");
unexpected(!(hundred != zeroSt), "STAmount fail");
unexpected(!(hundred != one), "STAmount fail");
unexpected((hundred != hundred), "STAmount fail");
unexpected((hundred != hundred), "STAmount fail"); // NOLINT(misc-redundant-expression)
unexpected(STAmount(noIssue()).getText() != "0", "STAmount fail");
unexpected(STAmount(noIssue(), 31).getText() != "31", "STAmount fail");
unexpected(STAmount(noIssue(), 31, 1).getText() != "310", "STAmount fail");
@@ -382,7 +391,8 @@ public:
divide(STAmount(noIssue(), 60), STAmount(noIssue(), 3), xrpIssue()).getText() != "20",
"STAmount divide fail");
STAmount a1(noIssue(), 60), a2(noIssue(), 10, -1);
STAmount const a1(noIssue(), 60);
STAmount const a2(noIssue(), 10, -1);
unexpected(
divide(a2, a1, noIssue()) != amountFromQuality(getRate(a1, a2)),
@@ -464,14 +474,14 @@ public:
{
testcase("underflow");
STAmount bigNative(STAmount::cMaxNative / 2);
STAmount bigValue(
STAmount const bigNative(STAmount::cMaxNative / 2);
STAmount const bigValue(
noIssue(), (STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMaxOffset - 1);
STAmount smallValue(
STAmount const smallValue(
noIssue(), (STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMinOffset + 1);
STAmount zeroSt(noIssue(), 0);
STAmount const zeroSt(noIssue(), 0);
STAmount smallXSmall = multiply(smallValue, smallValue, noIssue());
STAmount const smallXSmall = multiply(smallValue, smallValue, noIssue());
BEAST_EXPECT(smallXSmall == beast::zero);
@@ -822,43 +832,43 @@ public:
// Adding zero
{
STAmount amt1(XRPAmount(0));
STAmount amt2(XRPAmount(1000));
STAmount const amt1(XRPAmount(0));
STAmount const amt2(XRPAmount(1000));
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding zero
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(XRPAmount(0));
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(XRPAmount(0));
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding two positive XRP amounts
{
STAmount amt1(XRPAmount(500));
STAmount amt2(XRPAmount(1500));
STAmount const amt1(XRPAmount(500));
STAmount const amt2(XRPAmount(1500));
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding two negative XRP amounts
{
STAmount amt1(XRPAmount(-500));
STAmount amt2(XRPAmount(-1500));
STAmount const amt1(XRPAmount(-500));
STAmount const amt2(XRPAmount(-1500));
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding a positive and a negative XRP amount
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(XRPAmount(-1000));
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(XRPAmount(-1000));
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Overflow check for max XRP amounts
{
STAmount amt1(std::numeric_limits<XRPAmount::value_type>::max());
STAmount amt2(XRPAmount(1));
STAmount const amt1(std::numeric_limits<XRPAmount::value_type>::max());
STAmount const amt2(XRPAmount(1));
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
@@ -866,7 +876,7 @@ public:
{
STAmount amt1(std::numeric_limits<XRPAmount::value_type>::max());
amt1 += XRPAmount(1);
STAmount amt2(XRPAmount(-1));
STAmount const amt2(XRPAmount(-1));
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
}
@@ -881,50 +891,50 @@ public:
// Adding two IOU amounts
{
STAmount amt1(usd, 500);
STAmount amt2(usd, 1500);
STAmount const amt1(usd, 500);
STAmount const amt2(usd, 1500);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding a positive and a negative IOU amount
{
STAmount amt1(usd, 1000);
STAmount amt2(usd, -1000);
STAmount const amt1(usd, 1000);
STAmount const amt2(usd, -1000);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Overflow check for max IOU amounts
{
STAmount amt1(usd, std::numeric_limits<int64_t>::max());
STAmount amt2(usd, 1);
STAmount const amt1(usd, std::numeric_limits<int64_t>::max());
STAmount const amt2(usd, 1);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Overflow check for min IOU amounts
{
STAmount amt1(usd, std::numeric_limits<std::int64_t>::min());
STAmount amt2(usd, -1);
STAmount const amt1(usd, std::numeric_limits<std::int64_t>::min());
STAmount const amt2(usd, -1);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Adding XRP and IOU
{
STAmount amt1(XRPAmount(1));
STAmount amt2(usd, 1);
STAmount const amt1(XRPAmount(1));
STAmount const amt2(usd, 1);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Adding different IOU issues (non zero)
{
STAmount amt1(usd, 1000);
STAmount amt2(eur, 500);
STAmount const amt1(usd, 1000);
STAmount const amt2(eur, 500);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Adding different IOU issues (zero)
{
STAmount amt1(usd, 0);
STAmount amt2(eur, 500);
STAmount const amt1(usd, 0);
STAmount const amt2(eur, 500);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
}
@@ -939,43 +949,43 @@ public:
// Adding zero
{
STAmount amt1(mpt, 0);
STAmount amt2(mpt, 1000);
STAmount const amt1(mpt, 0);
STAmount const amt2(mpt, 1000);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding zero
{
STAmount amt1(mpt, 1000);
STAmount amt2(mpt, 0);
STAmount const amt1(mpt, 1000);
STAmount const amt2(mpt, 0);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding two positive MPT amounts
{
STAmount amt1(mpt, 500);
STAmount amt2(mpt, 1500);
STAmount const amt1(mpt, 500);
STAmount const amt2(mpt, 1500);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding two negative MPT amounts
{
STAmount amt1(mpt, -500);
STAmount amt2(mpt, -1500);
STAmount const amt1(mpt, -500);
STAmount const amt2(mpt, -1500);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Adding a positive and a negative MPT amount
{
STAmount amt1(mpt, 1000);
STAmount amt2(mpt, -1000);
STAmount const amt1(mpt, 1000);
STAmount const amt2(mpt, -1000);
BEAST_EXPECT(canAdd(amt1, amt2) == true);
}
// Overflow check for max MPT amounts
{
STAmount amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt2(mpt, 1);
STAmount const amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount const amt2(mpt, 1);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
@@ -985,22 +995,22 @@ public:
// Adding MPT and XRP
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(mpt, 1000);
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(mpt, 1000);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Adding different MPT issues (non zero)
{
STAmount amt1(mpt2, 500);
STAmount amt2(mpt, 500);
STAmount const amt1(mpt2, 500);
STAmount const amt2(mpt, 500);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
// Adding different MPT issues (non zero)
{
STAmount amt1(mpt2, 0);
STAmount amt2(mpt, 500);
STAmount const amt1(mpt2, 0);
STAmount const amt2(mpt, 500);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
}
@@ -1012,36 +1022,36 @@ public:
// Subtracting zero
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(XRPAmount(0));
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(XRPAmount(0));
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting zero
{
STAmount amt1(XRPAmount(0));
STAmount amt2(XRPAmount(1000));
STAmount const amt1(XRPAmount(0));
STAmount const amt2(XRPAmount(1000));
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting two positive XRP amounts
{
STAmount amt1(XRPAmount(1500));
STAmount amt2(XRPAmount(500));
STAmount const amt1(XRPAmount(1500));
STAmount const amt2(XRPAmount(500));
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting two negative XRP amounts
{
STAmount amt1(XRPAmount(-1500));
STAmount amt2(XRPAmount(-500));
STAmount const amt1(XRPAmount(-1500));
STAmount const amt2(XRPAmount(-500));
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting a positive and a negative XRP amount
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(XRPAmount(-1000));
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(XRPAmount(-1000));
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
@@ -1049,14 +1059,14 @@ public:
{
STAmount amt1(std::numeric_limits<XRPAmount::value_type>::max());
amt1 += XRPAmount(1);
STAmount amt2(XRPAmount(1));
STAmount const amt2(XRPAmount(1));
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Overflow check for max XRP amounts
{
STAmount amt1(std::numeric_limits<XRPAmount::value_type>::max());
STAmount amt2(XRPAmount(-1));
STAmount const amt1(std::numeric_limits<XRPAmount::value_type>::max());
STAmount const amt2(XRPAmount(-1));
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
}
@@ -1070,29 +1080,29 @@ public:
// Subtracting two IOU amounts
{
STAmount amt1(usd, 1500);
STAmount amt2(usd, 500);
STAmount const amt1(usd, 1500);
STAmount const amt2(usd, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting XRP and IOU
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(usd, 1000);
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(usd, 1000);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting different IOU issues (non zero)
{
STAmount amt1(usd, 1000);
STAmount amt2(eur, 500);
STAmount const amt1(usd, 1000);
STAmount const amt2(eur, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting different IOU issues (zero)
{
STAmount amt1(usd, 0);
STAmount amt2(eur, 500);
STAmount const amt1(usd, 0);
STAmount const amt2(eur, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
}
@@ -1107,36 +1117,36 @@ public:
// Subtracting zero
{
STAmount amt1(mpt, 1000);
STAmount amt2(mpt, 0);
STAmount const amt1(mpt, 1000);
STAmount const amt2(mpt, 0);
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting zero
{
STAmount amt1(mpt, 0);
STAmount amt2(mpt, 1000);
STAmount const amt1(mpt, 0);
STAmount const amt2(mpt, 1000);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting two positive MPT amounts
{
STAmount amt1(mpt, 1500);
STAmount amt2(mpt, 500);
STAmount const amt1(mpt, 1500);
STAmount const amt2(mpt, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting two negative MPT amounts
{
STAmount amt1(mpt, -1500);
STAmount amt2(mpt, -500);
STAmount const amt1(mpt, -1500);
STAmount const amt2(mpt, -500);
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
// Subtracting a positive and a negative MPT amount
{
STAmount amt1(mpt, 1000);
STAmount amt2(mpt, -1000);
STAmount const amt1(mpt, 1000);
STAmount const amt2(mpt, -1000);
BEAST_EXPECT(canSubtract(amt1, amt2) == true);
}
@@ -1146,29 +1156,29 @@ public:
// Overflow check for max positive MPT amounts (should fail)
{
STAmount amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt2(mpt, -2);
STAmount const amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount const amt2(mpt, -2);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting MPT and XRP
{
STAmount amt1(XRPAmount(1000));
STAmount amt2(mpt, 1000);
STAmount const amt1(XRPAmount(1000));
STAmount const amt2(mpt, 1000);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting different MPT issues (non zero)
{
STAmount amt1(mpt, 1000);
STAmount amt2(mpt2, 500);
STAmount const amt1(mpt, 1000);
STAmount const amt2(mpt2, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
// Subtracting different MPT issues (zero)
{
STAmount amt1(mpt, 0);
STAmount amt2(mpt2, 500);
STAmount const amt1(mpt, 0);
STAmount const amt2(mpt2, 500);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}
}

View File

@@ -12,14 +12,14 @@ struct STInteger_test : public beast::unit_test::suite
testUInt8()
{
testcase("UInt8");
STUInt8 u8(255);
STUInt8 const u8(255);
BEAST_EXPECT(u8.value() == 255);
BEAST_EXPECT(u8.getText() == "255");
BEAST_EXPECT(u8.getSType() == STI_UINT8);
BEAST_EXPECT(u8.getJson(JsonOptions::none) == 255);
// there is some special handling for sfTransactionResult
STUInt8 tr(sfTransactionResult, 0);
STUInt8 const tr(sfTransactionResult, 0);
BEAST_EXPECT(tr.value() == 0);
BEAST_EXPECT(
tr.getText() == "The transaction was applied. Only final in a validated ledger.");
@@ -27,7 +27,7 @@ struct STInteger_test : public beast::unit_test::suite
BEAST_EXPECT(tr.getJson(JsonOptions::none) == "tesSUCCESS");
// invalid transaction result
STUInt8 tr2(sfTransactionResult, 255);
STUInt8 const tr2(sfTransactionResult, 255);
BEAST_EXPECT(tr2.value() == 255);
BEAST_EXPECT(tr2.getText() == "255");
BEAST_EXPECT(tr2.getSType() == STI_UINT8);
@@ -38,21 +38,21 @@ struct STInteger_test : public beast::unit_test::suite
testUInt16()
{
testcase("UInt16");
STUInt16 u16(65535);
STUInt16 const u16(65535);
BEAST_EXPECT(u16.value() == 65535);
BEAST_EXPECT(u16.getText() == "65535");
BEAST_EXPECT(u16.getSType() == STI_UINT16);
BEAST_EXPECT(u16.getJson(JsonOptions::none) == 65535);
// there is some special handling for sfLedgerEntryType
STUInt16 let(sfLedgerEntryType, ltACCOUNT_ROOT);
STUInt16 const let(sfLedgerEntryType, ltACCOUNT_ROOT);
BEAST_EXPECT(let.value() == ltACCOUNT_ROOT);
BEAST_EXPECT(let.getText() == "AccountRoot");
BEAST_EXPECT(let.getSType() == STI_UINT16);
BEAST_EXPECT(let.getJson(JsonOptions::none) == "AccountRoot");
// there is some special handling for sfTransactionType
STUInt16 tlt(sfTransactionType, ttPAYMENT);
STUInt16 const tlt(sfTransactionType, ttPAYMENT);
BEAST_EXPECT(tlt.value() == ttPAYMENT);
BEAST_EXPECT(tlt.getText() == "Payment");
BEAST_EXPECT(tlt.getSType() == STI_UINT16);
@@ -63,19 +63,19 @@ struct STInteger_test : public beast::unit_test::suite
testUInt32()
{
testcase("UInt32");
STUInt32 u32(4'294'967'295u);
STUInt32 const u32(4'294'967'295u);
BEAST_EXPECT(u32.value() == 4'294'967'295u);
BEAST_EXPECT(u32.getText() == "4294967295");
BEAST_EXPECT(u32.getSType() == STI_UINT32);
BEAST_EXPECT(u32.getJson(JsonOptions::none) == 4'294'967'295u);
// there is some special handling for sfPermissionValue
STUInt32 pv(sfPermissionValue, ttPAYMENT + 1);
STUInt32 const pv(sfPermissionValue, ttPAYMENT + 1);
BEAST_EXPECT(pv.value() == ttPAYMENT + 1);
BEAST_EXPECT(pv.getText() == "Payment");
BEAST_EXPECT(pv.getSType() == STI_UINT32);
BEAST_EXPECT(pv.getJson(JsonOptions::none) == "Payment");
STUInt32 pv2(sfPermissionValue, PaymentMint);
STUInt32 const pv2(sfPermissionValue, PaymentMint);
BEAST_EXPECT(pv2.value() == PaymentMint);
BEAST_EXPECT(pv2.getText() == "PaymentMint");
BEAST_EXPECT(pv2.getSType() == STI_UINT32);
@@ -86,7 +86,7 @@ struct STInteger_test : public beast::unit_test::suite
testUInt64()
{
testcase("UInt64");
STUInt64 u64(0xFFFFFFFFFFFFFFFFull);
STUInt64 const u64(0xFFFFFFFFFFFFFFFFull);
BEAST_EXPECT(u64.value() == 0xFFFFFFFFFFFFFFFFull);
BEAST_EXPECT(u64.getText() == "18446744073709551615");
BEAST_EXPECT(u64.getSType() == STI_UINT64);
@@ -96,7 +96,7 @@ struct STInteger_test : public beast::unit_test::suite
BEAST_EXPECT(jsonVal.isString());
BEAST_EXPECT(jsonVal.asString() == "ffffffffffffffff");
STUInt64 u64_2(sfMaximumAmount, 0xFFFFFFFFFFFFFFFFull);
STUInt64 const u64_2(sfMaximumAmount, 0xFFFFFFFFFFFFFFFFull);
BEAST_EXPECT(u64_2.value() == 0xFFFFFFFFFFFFFFFFull);
BEAST_EXPECT(u64_2.getText() == "18446744073709551615");
BEAST_EXPECT(u64_2.getSType() == STI_UINT64);
@@ -109,7 +109,7 @@ struct STInteger_test : public beast::unit_test::suite
testcase("Int32");
{
int const minInt32 = -2147483648;
STInt32 i32(minInt32);
STInt32 const i32(minInt32);
BEAST_EXPECT(i32.value() == minInt32);
BEAST_EXPECT(i32.getText() == "-2147483648");
BEAST_EXPECT(i32.getSType() == STI_INT32);
@@ -118,7 +118,7 @@ struct STInteger_test : public beast::unit_test::suite
{
int const maxInt32 = 2147483647;
STInt32 i32(maxInt32);
STInt32 const i32(maxInt32);
BEAST_EXPECT(i32.value() == maxInt32);
BEAST_EXPECT(i32.getText() == "2147483647");
BEAST_EXPECT(i32.getSType() == STI_INT32);

View File

@@ -22,7 +22,7 @@ public:
{
issue = xrpIssue();
issue.account = alice;
STIssue stissue(sfAsset, Asset{issue});
STIssue const stissue(sfAsset, Asset{issue});
fail("Inconsistent XRP Issue doesn't fail");
}
catch (...)
@@ -34,7 +34,7 @@ public:
{
issue = USD;
issue.account = xrpAccount();
STIssue stissue(sfAsset, Asset{issue});
STIssue const stissue(sfAsset, Asset{issue});
fail("Inconsistent IOU Issue doesn't fail");
}
catch (...)
@@ -51,7 +51,7 @@ public:
base_uint<320> uint;
(void)uint.parseHex(data);
SerialIter iter(Slice(uint.data(), uint.size()));
STIssue stissue(iter, sfAsset);
STIssue const stissue(iter, sfAsset);
fail("Inconsistent IOU Issue doesn't fail on serializer");
}
catch (...)
@@ -61,7 +61,7 @@ public:
try
{
STIssue stissue(sfAsset, Asset{xrpIssue()});
STIssue const stissue(sfAsset, Asset{xrpIssue()});
}
catch (...)
{
@@ -70,7 +70,7 @@ public:
try
{
STIssue stissue(sfAsset, Asset{USD});
STIssue const stissue(sfAsset, Asset{USD});
}
catch (...)
{
@@ -85,7 +85,7 @@ public:
base_uint<320> uint;
(void)uint.parseHex(data);
SerialIter iter(Slice(uint.data(), uint.size()));
STIssue stissue(iter, sfAsset);
STIssue const stissue(iter, sfAsset);
BEAST_EXPECT(stissue.value() == USD);
}
catch (...)
@@ -99,7 +99,7 @@ public:
base_uint<160> uint;
(void)uint.parseHex(data);
SerialIter iter(Slice(uint.data(), uint.size()));
STIssue stissue(iter, sfAsset);
STIssue const stissue(iter, sfAsset);
BEAST_EXPECT(stissue.value() == xrpCurrency());
}
catch (...)

View File

@@ -45,19 +45,19 @@ struct STNumber_test : public beast::unit_test::suite
0,
1,
std::numeric_limits<std::int64_t>::max()};
for (std::int64_t mantissa : mantissas)
for (std::int64_t const mantissa : mantissas)
testCombo(Number{mantissa});
std::initializer_list<std::int32_t> const exponents = {
Number::minExponent, -1, 0, 1, Number::maxExponent - 1};
for (std::int32_t exponent : exponents)
for (std::int32_t const exponent : exponents)
testCombo(Number{123, exponent});
{
STAmount const strikePrice{noIssue(), 100};
STNumber const factor{sfNumber, 100};
auto const iouValue = strikePrice.iou();
IOUAmount totalValue{iouValue * factor};
IOUAmount const totalValue{iouValue * factor};
STAmount const totalAmount{totalValue, strikePrice.issue()};
BEAST_EXPECT(totalAmount == Number{10'000});
}
@@ -95,7 +95,7 @@ struct STNumber_test : public beast::unit_test::suite
BEAST_EXPECT(numberFromJson(sfNumber, "-0.000e6") == STNumber(sfNumber, 0));
{
NumberRoundModeGuard mg(Number::towards_zero);
NumberRoundModeGuard const mg(Number::towards_zero);
// maxint64 9,223,372,036,854,775,807
auto const maxInt = std::to_string(std::numeric_limits<std::int64_t>::max());
// minint64 -9,223,372,036,854,775,808
@@ -276,7 +276,7 @@ struct STNumber_test : public beast::unit_test::suite
for (auto const scale : {MantissaRange::small, MantissaRange::large})
{
NumberMantissaScaleGuard sg(scale);
NumberMantissaScaleGuard const sg(scale);
testcase << to_string(Number::getMantissaScale());
doRun();
}

View File

@@ -13,7 +13,8 @@ public:
unexpected(sfGeneric.isUseful(), "sfGeneric must not be useful");
{
// Try to put sfGeneric in an SOTemplate.
except<std::runtime_error>([&]() { SOTemplate elements{{sfGeneric, soeREQUIRED}}; });
except<std::runtime_error>(
[&]() { SOTemplate const elements{{sfGeneric, soeREQUIRED}}; });
}
unexpected(sfInvalid.isUseful(), "sfInvalid must not be useful");
@@ -31,12 +32,13 @@ public:
}
{
// Try to put sfInvalid in an SOTemplate.
except<std::runtime_error>([&]() { SOTemplate elements{{sfInvalid, soeREQUIRED}}; });
except<std::runtime_error>(
[&]() { SOTemplate const elements{{sfInvalid, soeREQUIRED}}; });
}
{
// Try to put the same SField into an SOTemplate twice.
except<std::runtime_error>([&]() {
SOTemplate elements{
SOTemplate const elements{
{sfAccount, soeREQUIRED},
{sfAccount, soeREQUIRED},
};
@@ -59,7 +61,7 @@ public:
};
STObject object1(elements, sfTestObject);
STObject object2(object1);
STObject const object2(object1);
unexpected(object1.getSerializer() != object2.getSerializer(), "STObject error 1");
@@ -106,7 +108,7 @@ public:
for (int i = 0; i < 1000; i++)
{
Blob j(i, 2);
Blob const j(i, 2);
object1.setFieldVL(sfTestVL, j);
@@ -114,7 +116,7 @@ public:
object1.add(s);
SerialIter it(s.slice());
STObject object3(elements, it, sfTestObject);
STObject const object3(elements, it, sfTestObject);
unexpected(object1.getFieldVL(sfTestVL) != j, "STObject error");
@@ -134,7 +136,7 @@ public:
object1.add(s);
SerialIter it(s.slice());
STObject object3(elements, it, sfTestObject);
STObject const object3(elements, it, sfTestObject);
auto const& uints1 = object1.getFieldV256(sfTestV256);
auto const& uints3 = object3.getFieldV256(sfTestV256);
@@ -475,7 +477,7 @@ public:
run() override
{
// Instantiate a jtx::Env so debugLog writes are exercised.
test::jtx::Env env(*this);
test::jtx::Env const env(*this);
testFields();
testSerialization();

File diff suppressed because it is too large Load Diff

View File

@@ -1149,7 +1149,7 @@ public:
// Construct an SOTemplate to get the ball rolling on building
// an STObject that can contain an STArray.
SOTemplate recurse{
SOTemplate const recurse{
{sfTransactionMetaData, soeOPTIONAL},
{sfTransactionHash, soeOPTIONAL},
{sfTemplate, soeOPTIONAL},
@@ -1211,7 +1211,7 @@ public:
// Make an otherwise legit STTx with a duplicate field. Should
// generate an exception when we deserialize.
auto const keypair = randomKeyPair(KeyType::secp256k1);
STTx acctSet(ttACCOUNT_SET, [&keypair](auto& obj) {
STTx const acctSet(ttACCOUNT_SET, [&keypair](auto& obj) {
obj.setAccountID(sfAccount, calcAccountID(keypair.first));
obj.setFieldU32(sfSequence, 7);
obj.setFieldAmount(sfFee, STAmount(2557891634ull));
@@ -1329,7 +1329,7 @@ public:
Serializer rawTxn;
j.add(rawTxn);
SerialIter sit(rawTxn.slice());
STTx copy(sit);
STTx const copy(sit);
if (copy != j)
{
@@ -1466,7 +1466,7 @@ public:
auto const id2 = calcAccountID(kp2.first);
// Get the stream of the transaction for use in multi-signing.
Serializer s = buildMultiSigningData(txn, id2);
Serializer const s = buildMultiSigningData(txn, id2);
auto const saMultiSignature = sign(kp2.first, kp2.second, s.slice());
@@ -1497,7 +1497,7 @@ public:
bool serialized = false;
try
{
STTx copy(sit);
STTx const copy(sit);
serialized = true;
}
catch (std::exception const&)

View File

@@ -216,7 +216,7 @@ public:
auto s = good;
// Remove all characters from the string in random order:
std::hash<std::string> r;
std::hash<std::string> const r;
while (!s.empty())
{

View File

@@ -17,7 +17,7 @@ struct Serializer_test : public beast::unit_test::suite
0,
1,
std::numeric_limits<std::int32_t>::max()};
for (std::int32_t value : values)
for (std::int32_t const value : values)
{
Serializer s;
s.add32(value);
@@ -33,7 +33,7 @@ struct Serializer_test : public beast::unit_test::suite
0,
1,
std::numeric_limits<std::int64_t>::max()};
for (std::int64_t value : values)
for (std::int64_t const value : values)
{
Serializer s;
s.add64(value);

View File

@@ -13,7 +13,7 @@ struct TER_test : public beast::unit_test::suite
{
for (auto i = -400; i < 400; ++i)
{
TER t = TER::fromInt(i);
TER const t = TER::fromInt(i);
auto inRange = isTelLocal(t) || isTemMalformed(t) || isTefFailure(t) || isTerRetry(t) ||
isTesSuccess(t) || isTecClaim(t);
@@ -75,7 +75,7 @@ struct TER_test : public beast::unit_test::suite
std::enable_if_t<I1 != 0>
testIterate(Tup const& tup, beast::unit_test::suite& s)
{
Func<I1, I2> func;
Func<I1, I2> const func;
func(tup, s);
testIterate<I1 - 1, I2, Func>(tup, s);
}
@@ -89,7 +89,7 @@ struct TER_test : public beast::unit_test::suite
std::enable_if_t<I1 == 0 && I2 != 0>
testIterate(Tup const& tup, beast::unit_test::suite& s)
{
Func<I1, I2> func;
Func<I1, I2> const func;
func(tup, s);
testIterate<std::tuple_size<Tup>::value - 1, I2 - 1, Func>(tup, s);
}
@@ -103,7 +103,7 @@ struct TER_test : public beast::unit_test::suite
std::enable_if_t<I1 == 0 && I2 == 0>
testIterate(Tup const& tup, beast::unit_test::suite& s)
{
Func<I1, I2> func;
Func<I1, I2> const func;
func(tup, s);
}