21#include <xrpl/beast/unit_test.h>
22#include <xrpl/protocol/Feature.h>
33 testcase(
"Convert all of an asset using DeliverMin");
36 auto const gw =
Account(
"gateway");
37 auto const USD = gw[
"USD"];
40 Env env(*
this, features);
41 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
42 env.
trust(USD(100),
"alice",
"bob",
"carol");
43 env(
pay(
"alice",
"bob", USD(10)),
46 env(
pay(
"alice",
"bob", USD(10)),
50 env(
pay(
"alice",
"bob", USD(10)),
54 env(
pay(
"alice",
"bob", USD(10)),
58 env(
pay(
"alice",
"bob", USD(10)),
62 env(
pay(gw,
"carol", USD(50)));
64 env(
pay(
"alice",
"bob", USD(10)),
75 Env env(*
this, features);
76 env.
fund(
XRP(10000),
"alice",
"bob", gw);
77 env.
trust(USD(1000),
"alice",
"bob");
78 env(
pay(gw,
"bob", USD(100)));
79 env(
offer(
"bob",
XRP(100), USD(100)));
80 env(
pay(
"alice",
"alice", USD(10000)),
89 Env env(*
this, features);
90 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
91 env.
trust(USD(1000),
"bob",
"carol");
92 env(
pay(gw,
"bob", USD(200)));
93 env(
offer(
"bob",
XRP(100), USD(100)));
94 env(
offer(
"bob",
XRP(1000), USD(100)));
95 env(
offer(
"bob",
XRP(10000), USD(100)));
96 env(
pay(
"alice",
"carol", USD(10000)),
102 env(
pay(
"alice",
"carol", USD(10000)),
112 Env env(*
this, features);
113 env.
fund(
XRP(10000),
"alice",
"bob",
"carol",
"dan", gw);
114 env.
trust(USD(1000),
"bob",
"carol",
"dan");
115 env(
pay(gw,
"bob", USD(100)));
116 env(
pay(gw,
"dan", USD(100)));
117 env(
offer(
"bob",
XRP(100), USD(100)));
118 env(
offer(
"bob",
XRP(1000), USD(100)));
119 env(
offer(
"dan",
XRP(100), USD(100)));
120 env(
pay(
"alice",
"carol", USD(10000)),
141BEAST_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.
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.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
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.
FeatureBitset supported_amendments()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t tfPartialPayment