mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make XRPAmount constructor explicit:
Remove the implicit conversion from int64 to XRPAmount. The motivation for this was noticing that many calls to `to_string` with an integer parameter type were calling the wrong `to_string` function. Since the calls were not prefixed with `std::`, and there is no ADL to call `std::to_string`, this was converting the int to an `XRPAmount` and calling `to_string(XRPAmount)`. Since `to_string(XRPAmount)` did the same thing as `to_string(int)` this error went undetected.
This commit is contained in:
@@ -41,12 +41,10 @@ public:
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 0 }, l, fees, false) ==
|
||||
XRPAmount{ 0 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 10000 }, l, fees, false) ==
|
||||
XRPAmount{ 10000 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 1 }, l, fees, false) ==
|
||||
XRPAmount{ 1 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) == XRPAmount{10000});
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{1});
|
||||
}
|
||||
{
|
||||
Fees const fees = [&]() {
|
||||
@@ -58,12 +56,10 @@ public:
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 0 }, l, fees, false) ==
|
||||
XRPAmount{ 0 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 10000 }, l, fees, false) ==
|
||||
XRPAmount{ 100000 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 1 }, l, fees, false) ==
|
||||
XRPAmount{ 10 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) == XRPAmount{100000});
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{10});
|
||||
}
|
||||
{
|
||||
Fees const fees = [&]()
|
||||
@@ -76,12 +72,10 @@ public:
|
||||
return f;
|
||||
}();
|
||||
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 0 }, l, fees, false) ==
|
||||
XRPAmount{ 0 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 10000 }, l, fees, false) ==
|
||||
XRPAmount{ 1000 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{ 1 }, l, fees, false) ==
|
||||
XRPAmount{ 0 });
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{0}, l, fees, false) == XRPAmount{0});
|
||||
BEAST_EXPECT(
|
||||
scaleFeeLoad(FeeUnit64{10000}, l, fees, false) == XRPAmount{1000});
|
||||
BEAST_EXPECT(scaleFeeLoad(FeeUnit64{1}, l, fees, false) == XRPAmount{0});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user