Skip to content

Commit

Permalink
[FOLD] Fix a couple of out of range test values
Browse files Browse the repository at this point in the history
  • Loading branch information
ximinez committed Oct 2, 2019
1 parent 0d64a99 commit 0ce6ae6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/test/ledger/CashDiff_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class CashDiff_test : public beast::unit_test::suite
oldProbe = newProbe;
newProbe = oldProbe * 10;
e10 += 1;
} while (newProbe > oldProbe);
} while (newProbe > oldProbe &&
newProbe < std::numeric_limits<std::int64_t>::max());
}
{
// Test XRP.
Expand All @@ -92,7 +93,8 @@ class CashDiff_test : public beast::unit_test::suite
oldProbe = newProbe;
newProbe = oldProbe * 10;
e10 += 1;
} while (newProbe > oldProbe);
} while (newProbe > oldProbe &&
newProbe < std::numeric_limits<std::int64_t>::max());
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/ledger/Invariants_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class Invariants_test : public beast::unit_test::suite
doInvariantCheck (enabled,
{{ "incorrect account XRP balance" },
{ "XRP net change was positive: 99999999000000001" }},
[self = this](Account const& A1, Account const&, ApplyContext& ac)
[this](Account const& A1, Account const&, ApplyContext& ac)
{
// balance exceeds genesis amount
auto const sle = ac.view().peek (keylet::account(A1.id()));
Expand All @@ -257,22 +257,22 @@ class Invariants_test : public beast::unit_test::suite
// with an invalid value
sle->setFieldAmount (sfBalance,
INITIAL_XRP + drops(1));
self->BEAST_EXPECT(!sle->getFieldAmount(sfBalance).negative());
BEAST_EXPECT(!sle->getFieldAmount(sfBalance).negative());
ac.view().update (sle);
return true;
});

doInvariantCheck (enabled,
{{ "incorrect account XRP balance" },
{ "XRP net change of -1000000001 doesn't match fee 0" }},
[self = this](Account const& A1, Account const&, ApplyContext& ac)
[this](Account const& A1, Account const&, ApplyContext& ac)
{
// balance is negative
auto const sle = ac.view().peek (keylet::account(A1.id()));
if(! sle)
return false;
sle->setFieldAmount (sfBalance, {1, true});
self->BEAST_EXPECT(sle->getFieldAmount(sfBalance).negative());
BEAST_EXPECT(sle->getFieldAmount(sfBalance).negative());
ac.view().update (sle);
return true;
});
Expand Down

0 comments on commit 0ce6ae6

Please sign in to comment.