1#include <xrpl/beast/unit_test/suite.h>
2#include <xrpl/beast/utility/Zero.h>
3#include <xrpl/protocol/AccountID.h>
4#include <xrpl/protocol/Issue.h>
5#include <xrpl/protocol/Quality.h>
6#include <xrpl/protocol/STAmount.h>
7#include <xrpl/protocol/UintTypes.h>
23 template <
class Integer>
31 template <
class Integer>
41 template <
class In,
class Out>
48 template <
class In1,
class Out1,
class Int,
class In2,
class Out2>
50 ceilIn(
Quality const& q, In1 in, Out1 out, Int limit, In2 inExpected, Out2 outExpected)
52 auto expectResult(
amounts(inExpected, outExpected));
55 BEAST_EXPECT(actualResult == expectResult);
58 template <
class In1,
class Out1,
class Int,
class In2,
class Out2>
60 ceilOut(
Quality const& q, In1 in, Out1 out, Int limit, In2 inExpected, Out2 outExpected)
62 auto const expectResult(
amounts(inExpected, outExpected));
65 BEAST_EXPECT(actualResult == expectResult);
260 Quality const q(0x5d048191fb9130daull);
263 raw(2755280000000000ull, -15));
266 BEAST_EXPECT(result.
in != beast::kZero);
275 Quality const q(0x59148191fb913522ull);
307 BEAST_EXPECT(q11 == q11);
308 BEAST_EXPECT(q11 < q12);
309 BEAST_EXPECT(q12 < q13);
310 BEAST_EXPECT(q31 < q21);
311 BEAST_EXPECT(q21 < q11);
312 BEAST_EXPECT(q11 >= q11);
313 BEAST_EXPECT(q12 >= q11);
314 BEAST_EXPECT(q13 >= q12);
315 BEAST_EXPECT(q21 >= q31);
316 BEAST_EXPECT(q11 >= q21);
317 BEAST_EXPECT(q12 > q11);
318 BEAST_EXPECT(q13 > q12);
319 BEAST_EXPECT(q21 > q31);
320 BEAST_EXPECT(q11 > q21);
321 BEAST_EXPECT(q11 <= q11);
322 BEAST_EXPECT(q11 <= q12);
323 BEAST_EXPECT(q12 <= q13);
324 BEAST_EXPECT(q31 <= q21);
325 BEAST_EXPECT(q21 <= q11);
326 BEAST_EXPECT(q31 != q21);
349 BEAST_EXPECT(q1331 == q3113);
350 BEAST_EXPECT(q1331 == q11);
363 BEAST_EXPECT(qa == qb);
364 BEAST_EXPECT(++qa != q11);
365 BEAST_EXPECT(qa != qb);
366 BEAST_EXPECT(--qb != q11);
367 BEAST_EXPECT(qa != qb);
368 BEAST_EXPECT(qb < qa);
369 BEAST_EXPECT(qb++ < qa);
370 BEAST_EXPECT(qb++ < qa);
371 BEAST_EXPECT(qb++ == qa);
372 BEAST_EXPECT(qa < qb);
TestcaseT testcase
Memberspace for declaring test cases.
A currency issued by an account.
static STAmount raw(std::uint64_t mantissa, int exponent)
static STAmount amount(Integer integer, std::enable_if_t< std::is_signed_v< Integer > > *=0)
void ceilOut(Quality const &q, In1 in, Out1 out, Int limit, In2 inExpected, Out2 outExpected)
void run() override
Runs the suite.
void ceilIn(Quality const &q, In1 in, Out1 out, Int limit, In2 inExpected, Out2 outExpected)
static Amounts amounts(In in, Out out)
static STAmount amount(Integer integer, std::enable_if_t<!std::is_signed_v< Integer > > *=0)
Represents the logical ratio of output currency to input currency.
STAmount rate() const
Returns the quality as STAmount.
Quality round(int tickSize) const
Returns the quality rounded up to the specified number of decimal digits.
Amounts ceilOut(Amounts const &amount, STAmount const &limit) const
Returns the scaled amount with out capped.
Amounts ceilIn(Amounts const &amount, STAmount const &limit) const
Returns the scaled amount with in capped.
std::string getText() const override
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TAmounts< STAmount, STAmount > Amounts
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, xrpl)
Quality composedQuality(Quality const &lhs, Quality const &rhs)
Calculate the quality of a two-hop path given the two hops.