Skip to content

Commit

Permalink
[FOLD] Extend unit-test insufficient reserve, add update both pairs test
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Oct 26, 2023
1 parent 38a0eaa commit 3a05f21
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/test/app/Oracle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ struct Oracle_test : public beast::unit_test::suite
Oracle oracle(
env, {.owner = owner, .ter = ter(tecINSUFFICIENT_RESERVE)});
}
// Insufficient reserve if the data series extends to greater than 5
{
Env env(*this);
env.fund(
env.current()->fees().accountReserve(1) +
env.current()->fees().base * 2,
owner);
Oracle oracle(env, {.owner = owner});
BEAST_EXPECT(oracle.exists());
oracle.set(UpdateArg{
.series =
{
{"XRP", "EUR", 740, 1},
{"XRP", "GBP", 740, 1},
{"XRP", "CNY", 740, 1},
{"XRP", "CAD", 740, 1},
{"XRP", "AUD", 740, 1},
},
.ter = ter(tecINSUFFICIENT_RESERVE)});
}

{
Env env(*this);
Expand Down Expand Up @@ -268,6 +288,12 @@ struct Oracle_test : public beast::unit_test::suite
oracle.set(UpdateArg{.series = {{"XRP", "EUR", 700, 2}}});
BEAST_EXPECT(
oracle.expectPrice({{"XRP", "USD", 0, 0}, {"XRP", "EUR", 700, 2}}));

// update both pairs
oracle.set(UpdateArg{
.series = {{"XRP", "USD", 741, 2}, {"XRP", "EUR", 710, 2}}});
BEAST_EXPECT(oracle.expectPrice(
{{"XRP", "USD", 741, 2}, {"XRP", "EUR", 710, 2}}));
}

void
Expand Down Expand Up @@ -295,7 +321,7 @@ struct Oracle_test : public beast::unit_test::suite
env(signers(alice, 2, {{becky, 1}, {bogie, 1}, {ed, 2}}), sig(alie));
env.close();
// if multiSignReserve disabled then its 2 + 1 per signer
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 5};
int const signerListOwners{features[featureMultiSignReserve] ? 1 : 6};
env.require(owners(alice, signerListOwners));

// Create
Expand Down

0 comments on commit 3a05f21

Please sign in to comment.