2#include <test/jtx/Account.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/amount.h>
5#include <test/jtx/offer.h>
6#include <test/jtx/pay.h>
8#include <xrpl/beast/unit_test/suite.h>
9#include <xrpl/ledger/BookDirs.h>
10#include <xrpl/protocol/Book.h>
11#include <xrpl/protocol/Feature.h>
12#include <xrpl/protocol/Issue.h>
13#include <xrpl/protocol/SField.h>
26 Env env(*
this, features);
29 env.
fund(
XRP(1000000),
"alice",
"bob",
"gw");
53 env(
offer(
"alice", gw[
"CNY"](50),
XRP(10)));
60 env(
pay(
"bob",
"alice",
Account(
"bob")[
"CNY"](10)));
68 for (
auto i = 1, j = 3; i <= 3; ++i, --j)
70 for (
auto k = 0; k < 80; ++k)
76 auto i = 1, j = 3, k = 0;
77 for (
auto const& e : d)
79 BEAST_EXPECT(e->getFieldAmount(sfTakerPays) == aud(i));
80 BEAST_EXPECT(e->getFieldAmount(sfTakerGets) ==
XRP(j));
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
XrpT const XRP
Converts to XRP Issue or STAmount.
FeatureBitset testableAmendments()
json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
Book reversed(Book const &book)
void testBookdir(FeatureBitset features)
void run() override
Runs the suite.