3#include <xrpl/beast/unit_test.h> 
    4#include <xrpl/protocol/Feature.h> 
   15        testcase(
"Convert all of an asset using DeliverMin");
 
   18        auto const gw = 
Account(
"gateway");
 
   19        auto const USD = gw[
"USD"];
 
   22            Env env(*
this, features);
 
   23            env.
fund(
XRP(10000), 
"alice", 
"bob", 
"carol", gw);
 
   25            env.
trust(USD(100), 
"alice", 
"bob", 
"carol");
 
   27            env(
pay(
"alice", 
"bob", USD(10)),
 
   30            env(
pay(
"alice", 
"bob", USD(10)),
 
   34            env(
pay(
"alice", 
"bob", USD(10)),
 
   38            env(
pay(
"alice", 
"bob", USD(10)),
 
   42            env(
pay(
"alice", 
"bob", USD(10)),
 
   46            env(
pay(gw, 
"carol", USD(50)));
 
   48            env(
pay(
"alice", 
"bob", USD(10)),
 
   60            Env env(*
this, features);
 
   61            env.
fund(
XRP(10000), 
"alice", 
"bob", gw);
 
   63            env.
trust(USD(1000), 
"alice", 
"bob");
 
   65            env(
pay(gw, 
"bob", USD(100)));
 
   66            env(
offer(
"bob", 
XRP(100), USD(100)));
 
   67            env(
pay(
"alice", 
"alice", USD(10000)),
 
   76            Env env(*
this, features);
 
   77            env.
fund(
XRP(10000), 
"alice", 
"bob", 
"carol", gw);
 
   79            env.
trust(USD(1000), 
"bob", 
"carol");
 
   81            env(
pay(gw, 
"bob", USD(200)));
 
   82            env(
offer(
"bob", 
XRP(100), USD(100)));
 
   83            env(
offer(
"bob", 
XRP(1000), USD(100)));
 
   84            env(
offer(
"bob", 
XRP(10000), USD(100)));
 
   85            env(
pay(
"alice", 
"carol", USD(10000)),
 
   91            env(
pay(
"alice", 
"carol", USD(10000)),
 
  101            Env env(*
this, features);
 
  102            env.
fund(
XRP(10000), 
"alice", 
"bob", 
"carol", 
"dan", gw);
 
  104            env.
trust(USD(1000), 
"bob", 
"carol", 
"dan");
 
  106            env(
pay(gw, 
"bob", USD(100)));
 
  107            env(
pay(gw, 
"dan", USD(100)));
 
  108            env(
offer(
"bob", 
XRP(100), USD(100)));
 
  109            env(
offer(
"bob", 
XRP(1000), USD(100)));
 
  110            env(
offer(
"dan", 
XRP(100), USD(100)));
 
  111            env(
pay(
"alice", 
"carol", USD(10000)),
 
 
 
  132BEAST_DEFINE_TESTSUITE(DeliverMin, app, 
ripple);
 
testcase_t testcase
Memberspace for declaring test cases.
 
void test_convert_all_of_an_asset(FeatureBitset features)
 
void run() override
Runs the suite.
 
Immutable cryptographic account descriptor.
 
A transaction testing environment.
 
void require(Args const &... args)
Check a set of requirements.
 
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
 
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
 
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
 
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
 
Sets the DeliverMin on a JTx.
 
Set Paths, SendMax on a JTx.
 
Sets the SendMax on a JTx.
 
Set the expected result code for a JTx The test will fail if the code doesn't match.
 
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
 
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
 
FeatureBitset testable_amendments()
 
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
 
XRP_t const XRP
Converts to XRP Issue or STAmount.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
constexpr std::uint32_t tfPartialPayment