test: Add tests to raise coverage of AMM (#4971)

---------

Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com>
Co-authored-by: Mark Travis <mtravis@ripple.com>
Co-authored-by: Bronek Kozicki <brok@incorrekt.com>
Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
Co-authored-by: Chenna Keshava <ckeshavabs@gmail.com>
This commit is contained in:
John Freeman
2024-04-18 14:25:22 -05:00
committed by GitHub
parent aae438315f
commit 24a275ba25
15 changed files with 581 additions and 287 deletions

View File

@@ -42,6 +42,9 @@
namespace ripple {
namespace test {
/**
* Tests of AMM that use offers too.
*/
struct AMMExtended_test : public jtx::AMMTest
{
private:
@@ -3614,6 +3617,8 @@ private:
int const signerListOwners{features[featureMultiSignReserve] ? 2 : 5};
env.require(owners(alice, signerListOwners + 0));
const msig ms{becky, bogie};
// Multisign all AMM transactions
AMM ammAlice(
env,
@@ -3625,7 +3630,7 @@ private:
ammCrtFee(env).drops(),
std::nullopt,
std::nullopt,
msig(becky, bogie),
ms,
ter(tesSUCCESS));
BEAST_EXPECT(ammAlice.expectBalances(
XRP(10'000), USD(10'000), ammAlice.tokens()));
@@ -3641,7 +3646,7 @@ private:
ammAlice.vote({}, 1'000);
BEAST_EXPECT(ammAlice.expectTradingFee(1'000));
ammAlice.bid(alice, 100);
env(ammAlice.bid({.account = alice, .bidMin = 100}), ms).close();
BEAST_EXPECT(ammAlice.expectAuctionSlot(100, 0, IOUAmount{4'000}));
// 4000 tokens burnt
BEAST_EXPECT(ammAlice.expectBalances(