chore: Set ColumnLimit to 120 in clang-format (#6288)

This change updates the ColumnLimit from 80 to 120, and applies clang-format to reformat the code.
This commit is contained in:
Ayaz Salikhov
2026-01-28 18:09:50 +00:00
committed by GitHub
parent 92046785d1
commit 5f638f5553
1016 changed files with 26918 additions and 66660 deletions

View File

@@ -35,18 +35,9 @@ public:
mantissa--;
if (mantissa < STAmount::cMinValue)
return {
amount.issue(),
mantissa,
amount.exponent(),
amount.negative()};
return {amount.issue(), mantissa, amount.exponent(), amount.negative()};
return {
amount.issue(),
mantissa,
amount.exponent(),
amount.negative(),
STAmount::unchecked{}};
return {amount.issue(), mantissa, amount.exponent(), amount.negative(), STAmount::unchecked{}};
}
if (valueDigits == 999999999)
@@ -54,18 +45,9 @@ public:
mantissa++;
if (mantissa > STAmount::cMaxValue)
return {
amount.issue(),
mantissa,
amount.exponent(),
amount.negative()};
return {amount.issue(), mantissa, amount.exponent(), amount.negative()};
return {
amount.issue(),
mantissa,
amount.exponent(),
amount.negative(),
STAmount::unchecked{}};
return {amount.issue(), mantissa, amount.exponent(), amount.negative(), STAmount::unchecked{}};
}
return amount;
@@ -91,9 +73,8 @@ public:
if (res != cmp)
{
log << "(" << num.getText() << "/" << den.getText() << ") X "
<< mul.getText() << " = " << res.getText() << " not "
<< cmp.getText();
log << "(" << num.getText() << "/" << den.getText() << ") X " << mul.getText() << " = " << res.getText()
<< " not " << cmp.getText();
fail("Rounding");
return;
}
@@ -108,14 +89,11 @@ public:
BEAST_EXPECT(!prod1.native());
STAmount prod2(
noIssue(),
static_cast<std::uint64_t>(a) * static_cast<std::uint64_t>(b));
STAmount prod2(noIssue(), static_cast<std::uint64_t>(a) * static_cast<std::uint64_t>(b));
if (prod1 != prod2)
{
log << "nn(" << aa.getFullText() << " * " << bb.getFullText()
<< ") = " << prod1.getFullText() << " not "
log << "nn(" << aa.getFullText() << " * " << bb.getFullText() << ") = " << prod1.getFullText() << " not "
<< prod2.getFullText();
fail("Multiplication result is not exact");
}
@@ -124,10 +102,7 @@ public:
//--------------------------------------------------------------------------
void
testSetValue(
std::string const& value,
Issue const& issue,
bool success = true)
testSetValue(std::string const& value, Issue const& issue, bool success = true)
{
try
{
@@ -215,8 +190,7 @@ public:
// VFALCO NOTE Why repeat "STAmount fail" so many times??
unexpected(serializeAndDeserialize(zeroSt) != zeroSt, "STAmount fail");
unexpected(serializeAndDeserialize(one) != one, "STAmount fail");
unexpected(
serializeAndDeserialize(hundred) != hundred, "STAmount fail");
unexpected(serializeAndDeserialize(hundred) != hundred, "STAmount fail");
unexpected(!zeroSt.native(), "STAmount fail");
unexpected(!hundred.native(), "STAmount fail");
unexpected(zeroSt != beast::zero, "STAmount fail");
@@ -298,8 +272,7 @@ public:
STAmount zeroSt(noIssue()), one(noIssue(), 1), hundred(noIssue(), 100);
unexpected(serializeAndDeserialize(zeroSt) != zeroSt, "STAmount fail");
unexpected(serializeAndDeserialize(one) != one, "STAmount fail");
unexpected(
serializeAndDeserialize(hundred) != hundred, "STAmount fail");
unexpected(serializeAndDeserialize(hundred) != hundred, "STAmount fail");
unexpected(zeroSt.native(), "STAmount fail");
unexpected(hundred.native(), "STAmount fail");
unexpected(zeroSt != beast::zero, "STAmount fail");
@@ -361,33 +334,19 @@ public:
unexpected((hundred != hundred), "STAmount fail");
unexpected(STAmount(noIssue()).getText() != "0", "STAmount fail");
unexpected(STAmount(noIssue(), 31).getText() != "31", "STAmount fail");
unexpected(STAmount(noIssue(), 31, 1).getText() != "310", "STAmount fail");
unexpected(STAmount(noIssue(), 31, -1).getText() != "3.1", "STAmount fail");
unexpected(STAmount(noIssue(), 31, -2).getText() != "0.31", "STAmount fail");
unexpected(
STAmount(noIssue(), 31, 1).getText() != "310", "STAmount fail");
multiply(STAmount(noIssue(), 20), STAmount(3), noIssue()).getText() != "60", "STAmount multiply fail 1");
unexpected(
STAmount(noIssue(), 31, -1).getText() != "3.1", "STAmount fail");
unexpected(
STAmount(noIssue(), 31, -2).getText() != "0.31", "STAmount fail");
unexpected(
multiply(STAmount(noIssue(), 20), STAmount(3), noIssue())
.getText() != "60",
"STAmount multiply fail 1");
unexpected(
multiply(STAmount(noIssue(), 20), STAmount(3), xrpIssue())
.getText() != "60",
"STAmount multiply fail 2");
unexpected(
multiply(STAmount(20), STAmount(3), noIssue()).getText() != "60",
"STAmount multiply fail 3");
unexpected(
multiply(STAmount(20), STAmount(3), xrpIssue()).getText() != "60",
"STAmount multiply fail 4");
multiply(STAmount(noIssue(), 20), STAmount(3), xrpIssue()).getText() != "60", "STAmount multiply fail 2");
unexpected(multiply(STAmount(20), STAmount(3), noIssue()).getText() != "60", "STAmount multiply fail 3");
unexpected(multiply(STAmount(20), STAmount(3), xrpIssue()).getText() != "60", "STAmount multiply fail 4");
if (divide(STAmount(noIssue(), 60), STAmount(3), noIssue()).getText() !=
"20")
if (divide(STAmount(noIssue(), 60), STAmount(3), noIssue()).getText() != "20")
{
log << "60/3 = "
<< divide(STAmount(noIssue(), 60), STAmount(3), noIssue())
.getText();
log << "60/3 = " << divide(STAmount(noIssue(), 60), STAmount(3), noIssue()).getText();
fail("STAmount divide fail");
}
else
@@ -395,30 +354,21 @@ public:
pass();
}
unexpected(divide(STAmount(noIssue(), 60), STAmount(3), xrpIssue()).getText() != "20", "STAmount divide fail");
unexpected(
divide(STAmount(noIssue(), 60), STAmount(3), xrpIssue())
.getText() != "20",
divide(STAmount(noIssue(), 60), STAmount(noIssue(), 3), noIssue()).getText() != "20",
"STAmount divide fail");
unexpected(
divide(STAmount(noIssue(), 60), STAmount(noIssue(), 3), noIssue())
.getText() != "20",
"STAmount divide fail");
unexpected(
divide(STAmount(noIssue(), 60), STAmount(noIssue(), 3), xrpIssue())
.getText() != "20",
divide(STAmount(noIssue(), 60), STAmount(noIssue(), 3), xrpIssue()).getText() != "20",
"STAmount divide fail");
STAmount a1(noIssue(), 60), a2(noIssue(), 10, -1);
unexpected(
divide(a2, a1, noIssue()) != amountFromQuality(getRate(a1, a2)),
"STAmount setRate(getRate) fail");
unexpected(divide(a2, a1, noIssue()) != amountFromQuality(getRate(a1, a2)), "STAmount setRate(getRate) fail");
unexpected(
divide(a1, a2, noIssue()) != amountFromQuality(getRate(a2, a1)),
"STAmount setRate(getRate) fail");
unexpected(divide(a1, a2, noIssue()) != amountFromQuality(getRate(a2, a1)), "STAmount setRate(getRate) fail");
}
//--------------------------------------------------------------------------
@@ -433,13 +383,11 @@ public:
// and getNeeded
unexpected(
getRate(STAmount(1), STAmount(10)) !=
(((100ull - 14) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(1), STAmount(10)) != (((100ull - 14) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 1");
unexpected(
getRate(STAmount(10), STAmount(1)) !=
(((100ull - 16) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(10), STAmount(1)) != (((100ull - 16) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 2");
unexpected(
@@ -453,23 +401,19 @@ public:
"STAmount getRate fail 4");
unexpected(
getRate(STAmount(noIssue(), 1), STAmount(10)) !=
(((100ull - 14) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(noIssue(), 1), STAmount(10)) != (((100ull - 14) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 5");
unexpected(
getRate(STAmount(noIssue(), 10), STAmount(1)) !=
(((100ull - 16) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(noIssue(), 10), STAmount(1)) != (((100ull - 16) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 6");
unexpected(
getRate(STAmount(1), STAmount(noIssue(), 10)) !=
(((100ull - 14) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(1), STAmount(noIssue(), 10)) != (((100ull - 14) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 7");
unexpected(
getRate(STAmount(10), STAmount(noIssue(), 1)) !=
(((100ull - 16) << (64 - 8)) | 1000000000000000ull),
getRate(STAmount(10), STAmount(noIssue(), 1)) != (((100ull - 16) << (64 - 8)) | 1000000000000000ull),
"STAmount getRate fail 8");
roundTest(1, 3, 3);
@@ -493,14 +437,8 @@ public:
testcase("underflow");
STAmount bigNative(STAmount::cMaxNative / 2);
STAmount bigValue(
noIssue(),
(STAmount::cMinValue + STAmount::cMaxValue) / 2,
STAmount::cMaxOffset - 1);
STAmount smallValue(
noIssue(),
(STAmount::cMinValue + STAmount::cMaxValue) / 2,
STAmount::cMinOffset + 1);
STAmount bigValue(noIssue(), (STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMaxOffset - 1);
STAmount smallValue(noIssue(), (STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMinOffset + 1);
STAmount zeroSt(noIssue(), 0);
STAmount smallXsmall = multiply(smallValue, smallValue, noIssue());
@@ -600,13 +538,10 @@ public:
}
{
BEAST_EXPECT(
amountFromJson(sfNumber, Json::Value(42)) == XRPAmount(42));
BEAST_EXPECT(
amountFromJson(sfNumber, Json::Value(-42)) == XRPAmount(-42));
BEAST_EXPECT(amountFromJson(sfNumber, Json::Value(42)) == XRPAmount(42));
BEAST_EXPECT(amountFromJson(sfNumber, Json::Value(-42)) == XRPAmount(-42));
BEAST_EXPECT(
amountFromJson(sfNumber, Json::UInt(42)) == XRPAmount(42));
BEAST_EXPECT(amountFromJson(sfNumber, Json::UInt(42)) == XRPAmount(42));
BEAST_EXPECT(amountFromJson(sfNumber, "-123") == XRPAmount(-123));
@@ -614,29 +549,22 @@ public:
BEAST_EXPECT(amountFromJson(sfNumber, "-123") == XRPAmount(-123));
BEAST_EXPECT(amountFromJson(sfNumber, "3.14e2") == XRPAmount(314));
BEAST_EXPECT(
amountFromJson(sfNumber, "-3.14e2") == XRPAmount(-314));
BEAST_EXPECT(amountFromJson(sfNumber, "-3.14e2") == XRPAmount(-314));
BEAST_EXPECT(amountFromJson(sfNumber, "0") == XRPAmount(0));
BEAST_EXPECT(amountFromJson(sfNumber, "-0") == XRPAmount(0));
constexpr auto imin = std::numeric_limits<int>::min();
BEAST_EXPECT(amountFromJson(sfNumber, imin) == XRPAmount(imin));
BEAST_EXPECT(
amountFromJson(sfNumber, std::to_string(imin)) ==
XRPAmount(imin));
BEAST_EXPECT(amountFromJson(sfNumber, std::to_string(imin)) == XRPAmount(imin));
constexpr auto imax = std::numeric_limits<int>::max();
BEAST_EXPECT(amountFromJson(sfNumber, imax) == XRPAmount(imax));
BEAST_EXPECT(
amountFromJson(sfNumber, std::to_string(imax)) ==
XRPAmount(imax));
BEAST_EXPECT(amountFromJson(sfNumber, std::to_string(imax)) == XRPAmount(imax));
constexpr auto umax = std::numeric_limits<unsigned int>::max();
BEAST_EXPECT(amountFromJson(sfNumber, umax) == XRPAmount(umax));
BEAST_EXPECT(
amountFromJson(sfNumber, std::to_string(umax)) ==
XRPAmount(umax));
BEAST_EXPECT(amountFromJson(sfNumber, std::to_string(umax)) == XRPAmount(umax));
// XRP does not handle fractional part
try
@@ -646,8 +574,7 @@ public:
}
catch (std::runtime_error const& e)
{
std::string const expected =
"XRP and MPT must be specified as integral amount.";
std::string const expected = "XRP and MPT must be specified as integral amount.";
BEAST_EXPECT(e.what() == expected);
}
@@ -659,8 +586,7 @@ public:
}
catch (std::runtime_error const& e)
{
std::string const expected =
"XRP and MPT must be specified as integral amount.";
std::string const expected = "XRP and MPT must be specified as integral amount.";
BEAST_EXPECT(e.what() == expected);
}
@@ -716,8 +642,7 @@ public:
}
catch (std::runtime_error const& e)
{
std::string const expected =
"XRP may not be specified with a null Json value";
std::string const expected = "XRP may not be specified with a null Json value";
BEAST_EXPECT(e.what() == expected);
}
@@ -804,8 +729,7 @@ public:
Issue const usd{Currency(0x5553440000000000), AccountID(0x4985601)};
Issue const xrp{xrpIssue()};
for (std::uint64_t drops = 100000000000000000; drops != 1;
drops = drops / 10)
for (std::uint64_t drops = 100000000000000000; drops != 1; drops = drops / 10)
{
auto const t = amountFromString(xrp, std::to_string(drops));
auto const s = t.xrp();
@@ -837,8 +761,7 @@ public:
Issue const usd{Currency(0x5553440000000000), AccountID(0x4985601)};
Issue const xrp{xrpIssue()};
for (std::uint64_t dollars = 10000000000; dollars != 1;
dollars = dollars / 10)
for (std::uint64_t dollars = 10000000000; dollars != 1; dollars = dollars / 10)
{
auto const t = amountFromString(usd, std::to_string(dollars));
auto const s = t.iou();
@@ -1021,8 +944,7 @@ public:
// Overflow check for max MPT amounts
{
STAmount amt1(
mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt2(mpt, 1);
BEAST_EXPECT(canAdd(amt1, amt2) == false);
}
@@ -1194,8 +1116,7 @@ public:
// Overflow check for max positive MPT amounts (should fail)
{
STAmount amt1(
mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt1(mpt, std::numeric_limits<MPTAmount::value_type>::max());
STAmount amt2(mpt, -2);
BEAST_EXPECT(canSubtract(amt1, amt2) == false);
}