From 3a05f215b03ab0c00ac8b1e83a99942a3fe8b7d8 Mon Sep 17 00:00:00 2001 From: Gregory Tsipenyuk Date: Thu, 26 Oct 2023 14:41:32 -0400 Subject: [PATCH] [FOLD] Extend unit-test insufficient reserve, add update both pairs test --- src/test/app/Oracle_test.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/test/app/Oracle_test.cpp b/src/test/app/Oracle_test.cpp index c451f408b15..f93c18c45c3 100644 --- a/src/test/app/Oracle_test.cpp +++ b/src/test/app/Oracle_test.cpp @@ -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); @@ -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 @@ -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