mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-19 21:21:04 +00:00
Fix a couple of issues: fix error check, remove incorrect test
This commit is contained in:
@@ -429,10 +429,10 @@ Number::Guard::doDropDigitWithTarget(T& mantissa, int& exponent, int const targe
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
targetExponent > exponent, "Number::Guard::doDropDigitWithTarget : something to do");
|
||||
if (mantissa == 0 && unrecoverable() && targetExponent >= exponent)
|
||||
if (mantissa == 0 && unrecoverable() && targetExponent > exponent)
|
||||
{
|
||||
// No number of dropped digits is going to change any of the operative parameters at this
|
||||
// point
|
||||
// point.
|
||||
exponent = targetExponent;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -185,14 +185,16 @@ struct STNumber_test : public beast::unit_test::Suite
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
BEAST_EXPECT(std::string(e.what()) == expected);
|
||||
std::ostringstream out;
|
||||
out << "Json: " << num.asString() << " got exception: " << e.what()
|
||||
<< ", expected: " << expected;
|
||||
BEAST_EXPECTS(std::string(e.what()) == expected, out.str());
|
||||
}
|
||||
};
|
||||
|
||||
// Obvious overflows tested here
|
||||
expectJsonThrows("1e2000000", "Number::normalize 2");
|
||||
expectJsonThrows("1e2000000000", "Number::normalize 2");
|
||||
expectJsonThrows("1e2000000000000", "Number::normalize 2");
|
||||
|
||||
// Obvious non-numbers tested here
|
||||
expectJsonThrows("", "'' is not a number");
|
||||
|
||||
Reference in New Issue
Block a user