xrpld
Loading...
Searching...
No Matches
xrpl::test::LoanBroker_test Class Reference
Inheritance diagram for xrpl::test::LoanBroker_test:
Collaboration diagram for xrpl::test::LoanBroker_test:

Classes

struct  VaultInfo
struct  ExpectedByCleanup

Public Member Functions

void testDebtMaximumOutOfRange (FeatureBitset features)
void run () override
 Runs the suite.
template<class = void>
void operator() (Runner &r)
 Invokes the test using the specified runner.
template<class = void>
void pass ()
 Record a successful test condition.
template<class F, class String>
bool except (F &&f, String const &reason)
template<class F>
bool except (F &&f)
template<class E, class F, class String>
bool except (F &&f, String const &reason)
template<class E, class F>
bool except (F &&f)
template<class F, class String>
bool unexcept (F &&f, String const &reason)
template<class F>
bool unexcept (F &&f)
std::string const & arg () const
 Return the argument associated with the runner.
template<class Condition, class String>
bool unexpected (Condition shouldBeFalse, String const &reason)
 DEPRECATED.
template<class Condition>
bool unexpected (Condition shouldBeFalse)
template<class String>
void fail (String const &reason, char const *file, int line)
 Record a failure.
template<class = void>
void fail (std::string const &reason="")
template<class Condition>
bool expect (Condition const &shouldBeTrue)
 Evaluate a test condition.
template<class Condition, class String>
bool expect (Condition const &shouldBeTrue, String const &reason)
template<class Condition>
bool expect (Condition const &shouldBeTrue, char const *file, int line)
template<class Condition, class String>
bool expect (Condition const &shouldBeTrue, String const &reason, char const *file, int line)

Static Public Member Functions

static Suite * thisSuite ()
 Returns the "current" running suite.

Public Attributes

LogOs< char > log
 Logging output stream.
TestcaseT testcase
 Memberspace for declaring test cases.

Protected Member Functions

Runner & runner () const
 Lets a suite compose other suites (e.g.

Private Types

enum class  LoanBrokerTest {
  CoverClawback , CoverDeposit , CoverWithdraw , Delete ,
  Set
}

Private Member Functions

void testDisabled ()
void lifecycle (char const *label, jtx::Env &env, jtx::Account const &issuer, jtx::Account const &alice, jtx::Account const &evan, jtx::Account const &bystander, VaultInfo const &vault, VaultInfo const &badVault, std::function< jtx::JTx(jtx::JTx const &)> modifyJTx, std::function< void(SLE::ConstRef)> checkBroker, std::function< void(SLE::ConstRef)> changeBroker, std::function< void(SLE::ConstRef)> checkChangedBroker)
void testLifecycle ()
void testLoanBroker (std::function< jtx::PrettyAsset(jtx::Env &, jtx::Account const &, jtx::Account const &)> getAsset, LoanBrokerTest brokerTest)
void testInvalidLoanBrokerCoverClawback ()
void testInvalidLoanBrokerCoverDeposit ()
void testInvalidLoanBrokerCoverWithdraw ()
void testInvalidLoanBrokerDelete ()
void testInvalidLoanBrokerSet ()
void testLoanBrokerCoverDepositNullVault ()
void testRequireAuth ()
void testLoanBrokerSetDebtMaximum ()
void testRIPD4323 ()
void testAmB06VaultFreezeCheckMissing ()
void testLoanBrokerDeleteLockedMPT (FeatureBitset features)
void testLoanBrokerDeleteConfidentialCOA (FeatureBitset features)
void deleteBrokerAndCheck (jtx::Env &env, jtx::Account const &alice, jtx::PrettyAsset const &asset, Keylet const &brokerKeylet, TER expected)
void testLoanBrokerDeleteFrozenIOU (FeatureBitset features)
void testLoanBrokerDeleteCoverPayoutIOU ()
void testLoanBrokerDeleteRequireAuthMPT (FeatureBitset features)
void testLoanBrokerDeleteCoverPayoutMPT ()
void testCoverDepositFreezes ()
void testCoverWithdrawSelfWhileFrozen ()
void testCoverWithdrawFreezes ()
void testRIPD4274IOU ()
void testRIPD4274MPT ()
void testRIPD4274 ()
void testCoverWithdrawCredentialDepositPreauth (FeatureBitset features)
void testFixedPrecisionCover ()
void testFixedPrecisionCoverExactAtGridBoundaries ()
void testCoverPrecisionGuard ()
void testPrivateLoanBroker ()
void testPrivateLoanBrokerModify ()
void propagateAbort () const

Static Private Member Functions

static Keylet createBroker (jtx::Env &env, jtx::Account const &alice, jtx::PrettyAsset const &asset, std::int64_t cover)
static void leaveBelowReserve (jtx::Env &env, jtx::Account const &alice, jtx::Account const &sink, int incrementsShort)
static std::vector< std::tuple< std::string, FeatureBitset, TER > > cleanupRuns (FeatureBitset features, ExpectedByCleanup const &expected)
static Suite ** pThisSuite ()

Private Attributes

FeatureBitset const all_
bool abort_ = false
bool aborted_ = false
Runner * runner_ = nullptr

Detailed Description

Definition at line 73 of file LoanBroker_test.cpp.

Member Enumeration Documentation

◆ LoanBrokerTest

Enumerator
CoverClawback 
CoverDeposit 
CoverWithdraw 
Delete 
Set 

Definition at line 891 of file LoanBroker_test.cpp.

Member Function Documentation

◆ testDisabled()

void xrpl::test::LoanBroker_test::testDisabled ( )
private

Definition at line 87 of file LoanBroker_test.cpp.

◆ lifecycle()

void xrpl::test::LoanBroker_test::lifecycle ( char const * label,
jtx::Env & env,
jtx::Account const & issuer,
jtx::Account const & alice,
jtx::Account const & evan,
jtx::Account const & bystander,
VaultInfo const & vault,
VaultInfo const & badVault,
std::function< jtx::JTx(jtx::JTx const &)> modifyJTx,
std::function< void(SLE::ConstRef)> checkBroker,
std::function< void(SLE::ConstRef)> changeBroker,
std::function< void(SLE::ConstRef)> checkChangedBroker )
private

Definition at line 167 of file LoanBroker_test.cpp.

◆ testLifecycle()

void xrpl::test::LoanBroker_test::testLifecycle ( )
private

Definition at line 580 of file LoanBroker_test.cpp.

◆ testLoanBroker()

void xrpl::test::LoanBroker_test::testLoanBroker ( std::function< jtx::PrettyAsset(jtx::Env &, jtx::Account const &, jtx::Account const &)> getAsset,
LoanBrokerTest brokerTest )
private

Definition at line 894 of file LoanBroker_test.cpp.

◆ testInvalidLoanBrokerCoverClawback()

void xrpl::test::LoanBroker_test::testInvalidLoanBrokerCoverClawback ( )
private

Definition at line 1128 of file LoanBroker_test.cpp.

◆ testInvalidLoanBrokerCoverDeposit()

void xrpl::test::LoanBroker_test::testInvalidLoanBrokerCoverDeposit ( )
private

Definition at line 1179 of file LoanBroker_test.cpp.

◆ testInvalidLoanBrokerCoverWithdraw()

void xrpl::test::LoanBroker_test::testInvalidLoanBrokerCoverWithdraw ( )
private

Definition at line 1190 of file LoanBroker_test.cpp.

◆ testInvalidLoanBrokerDelete()

void xrpl::test::LoanBroker_test::testInvalidLoanBrokerDelete ( )
private

Definition at line 1209 of file LoanBroker_test.cpp.

◆ testInvalidLoanBrokerSet()

void xrpl::test::LoanBroker_test::testInvalidLoanBrokerSet ( )
private

Definition at line 1223 of file LoanBroker_test.cpp.

◆ testLoanBrokerCoverDepositNullVault()

void xrpl::test::LoanBroker_test::testLoanBrokerCoverDepositNullVault ( )
private

Definition at line 1239 of file LoanBroker_test.cpp.

◆ testRequireAuth()

void xrpl::test::LoanBroker_test::testRequireAuth ( )
private

Definition at line 1294 of file LoanBroker_test.cpp.

◆ testLoanBrokerSetDebtMaximum()

void xrpl::test::LoanBroker_test::testLoanBrokerSetDebtMaximum ( )
private

Definition at line 1405 of file LoanBroker_test.cpp.

◆ testRIPD4323()

void xrpl::test::LoanBroker_test::testRIPD4323 ( )
private

Definition at line 1569 of file LoanBroker_test.cpp.

◆ testAmB06VaultFreezeCheckMissing()

void xrpl::test::LoanBroker_test::testAmB06VaultFreezeCheckMissing ( )
private

Definition at line 1648 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteLockedMPT()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteLockedMPT ( FeatureBitset features)
private

Definition at line 1673 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteConfidentialCOA()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteConfidentialCOA ( FeatureBitset features)
private

Definition at line 1798 of file LoanBroker_test.cpp.

◆ createBroker()

Keylet xrpl::test::LoanBroker_test::createBroker ( jtx::Env & env,
jtx::Account const & alice,
jtx::PrettyAsset const & asset,
std::int64_t cover )
staticprivate

Definition at line 1909 of file LoanBroker_test.cpp.

◆ leaveBelowReserve()

void xrpl::test::LoanBroker_test::leaveBelowReserve ( jtx::Env & env,
jtx::Account const & alice,
jtx::Account const & sink,
int incrementsShort )
staticprivate

Definition at line 1941 of file LoanBroker_test.cpp.

◆ cleanupRuns()

std::vector< std::tuple< std::string, FeatureBitset, TER > > xrpl::test::LoanBroker_test::cleanupRuns ( FeatureBitset features,
ExpectedByCleanup const & expected )
staticprivate

Definition at line 1971 of file LoanBroker_test.cpp.

◆ deleteBrokerAndCheck()

void xrpl::test::LoanBroker_test::deleteBrokerAndCheck ( jtx::Env & env,
jtx::Account const & alice,
jtx::PrettyAsset const & asset,
Keylet const & brokerKeylet,
TER expected )
private

Definition at line 1989 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteFrozenIOU()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteFrozenIOU ( FeatureBitset features)
private

Definition at line 2029 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteCoverPayoutIOU()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteCoverPayoutIOU ( )
private

Definition at line 2099 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteRequireAuthMPT()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteRequireAuthMPT ( FeatureBitset features)
private

Definition at line 2335 of file LoanBroker_test.cpp.

◆ testLoanBrokerDeleteCoverPayoutMPT()

void xrpl::test::LoanBroker_test::testLoanBrokerDeleteCoverPayoutMPT ( )
private

Definition at line 2410 of file LoanBroker_test.cpp.

◆ testCoverDepositFreezes()

void xrpl::test::LoanBroker_test::testCoverDepositFreezes ( )
private

Definition at line 2592 of file LoanBroker_test.cpp.

◆ testCoverWithdrawSelfWhileFrozen()

void xrpl::test::LoanBroker_test::testCoverWithdrawSelfWhileFrozen ( )
private

Definition at line 2743 of file LoanBroker_test.cpp.

◆ testCoverWithdrawFreezes()

void xrpl::test::LoanBroker_test::testCoverWithdrawFreezes ( )
private

Definition at line 2808 of file LoanBroker_test.cpp.

◆ testRIPD4274IOU()

void xrpl::test::LoanBroker_test::testRIPD4274IOU ( )
private

Definition at line 3035 of file LoanBroker_test.cpp.

◆ testRIPD4274MPT()

void xrpl::test::LoanBroker_test::testRIPD4274MPT ( )
private

Definition at line 3163 of file LoanBroker_test.cpp.

◆ testRIPD4274()

void xrpl::test::LoanBroker_test::testRIPD4274 ( )
private

Definition at line 3280 of file LoanBroker_test.cpp.

◆ testCoverWithdrawCredentialDepositPreauth()

void xrpl::test::LoanBroker_test::testCoverWithdrawCredentialDepositPreauth ( FeatureBitset features)
private

Definition at line 3287 of file LoanBroker_test.cpp.

◆ testFixedPrecisionCover()

void xrpl::test::LoanBroker_test::testFixedPrecisionCover ( )
private

Definition at line 3413 of file LoanBroker_test.cpp.

◆ testFixedPrecisionCoverExactAtGridBoundaries()

void xrpl::test::LoanBroker_test::testFixedPrecisionCoverExactAtGridBoundaries ( )
private

Definition at line 3584 of file LoanBroker_test.cpp.

◆ testCoverPrecisionGuard()

void xrpl::test::LoanBroker_test::testCoverPrecisionGuard ( )
private

Definition at line 3670 of file LoanBroker_test.cpp.

◆ testPrivateLoanBroker()

void xrpl::test::LoanBroker_test::testPrivateLoanBroker ( )
private

Definition at line 3877 of file LoanBroker_test.cpp.

◆ testPrivateLoanBrokerModify()

void xrpl::test::LoanBroker_test::testPrivateLoanBrokerModify ( )
private

Definition at line 3957 of file LoanBroker_test.cpp.

◆ testDebtMaximumOutOfRange()

void xrpl::test::LoanBroker_test::testDebtMaximumOutOfRange ( FeatureBitset features)

Definition at line 4141 of file LoanBroker_test.cpp.

◆ run()

void xrpl::test::LoanBroker_test::run ( )
overridevirtual

Runs the suite.

Implements beast::unit_test::Suite.

Definition at line 4177 of file LoanBroker_test.cpp.

◆ thisSuite()

Suite * beast::unit_test::Suite::thisSuite ( )
staticinherited

Returns the "current" running suite.

If no suite is running, nullptr is returned.

Definition at line 162 of file suite.h.

◆ operator()()

template<class>
void beast::unit_test::Suite::operator() ( Runner & r)
inherited

Invokes the test using the specified runner.

Data members are set up here instead of the constructor as a convenience to writing the derived class to avoid repetition of forwarded constructor arguments to the base. Normally this is called by the framework for you.

Definition at line 420 of file suite.h.

◆ pass()

template<class>
void beast::unit_test::Suite::pass ( )
inherited

Record a successful test condition.

Definition at line 532 of file suite.h.

◆ fail() [1/2]

template<class String>
void beast::unit_test::Suite::fail ( String const & reason,
char const * file,
int line )
inherited

Record a failure.

Parameters
reasonOptional text added to the output on a failure.
fileThe source code file where the test failed.
lineThe source code line number where the test failed.

Definition at line 554 of file suite.h.

◆ fail() [2/2]

template<class>
void beast::unit_test::Suite::fail ( std::string const & reason = "")
inherited

Definition at line 541 of file suite.h.

◆ expect() [1/4]

template<class Condition>
bool beast::unit_test::Suite::expect ( Condition const & shouldBeTrue)
inherited

Evaluate a test condition.

This function provides improved logging by incorporating the file name and line number into the reported output on failure, as well as additional text specified by the caller.

Parameters
shouldBeTrueThe condition to test. The condition is evaluated in a boolean context.
reasonOptional added text to output on a failure.
fileThe source code file where the test failed.
lineThe source code line number where the test failed.
Returns
true if the test condition indicates success.

Definition at line 235 of file suite.h.

◆ expect() [2/4]

template<class Condition, class String>
bool beast::unit_test::Suite::expect ( Condition const & shouldBeTrue,
String const & reason )
inherited

Definition at line 437 of file suite.h.

◆ expect() [3/4]

template<class Condition>
bool beast::unit_test::Suite::expect ( Condition const & shouldBeTrue,
char const * file,
int line )
inherited

Definition at line 246 of file suite.h.

◆ expect() [4/4]

template<class Condition, class String>
bool beast::unit_test::Suite::expect ( Condition const & shouldBeTrue,
String const & reason,
char const * file,
int line )
inherited

Definition at line 450 of file suite.h.

◆ except() [1/4]

template<class F, class String>
bool beast::unit_test::Suite::except ( F && f,
String const & reason )
inherited

Definition at line 465 of file suite.h.

◆ except() [2/4]

template<class F>
bool beast::unit_test::Suite::except ( F && f)
inherited

Definition at line 265 of file suite.h.

◆ except() [3/4]

template<class E, class F, class String>
bool beast::unit_test::Suite::except ( F && f,
String const & reason )
inherited

Definition at line 482 of file suite.h.

◆ except() [4/4]

template<class E, class F>
bool beast::unit_test::Suite::except ( F && f)
inherited

Definition at line 274 of file suite.h.

◆ unexcept() [1/2]

template<class F, class String>
bool beast::unit_test::Suite::unexcept ( F && f,
String const & reason )
inherited

Definition at line 499 of file suite.h.

◆ unexcept() [2/2]

template<class F>
bool beast::unit_test::Suite::unexcept ( F && f)
inherited

Definition at line 283 of file suite.h.

◆ arg()

std::string const & beast::unit_test::Suite::arg ( ) const
inherited

Return the argument associated with the runner.

Definition at line 292 of file suite.h.

◆ runner()

Runner & beast::unit_test::Suite::runner ( ) const
protectedinherited

Lets a suite compose other suites (e.g.

an aggregator that reruns a group of related suites under its own name) via SuiteInfo::run.

Returns
The runner this suite is executing under.

Definition at line 305 of file suite.h.

◆ unexpected() [1/2]

template<class Condition, class String>
bool beast::unit_test::Suite::unexpected ( Condition shouldBeFalse,
String const & reason )
inherited

DEPRECATED.

Returns
true if the test condition indicates success(a false value)

Definition at line 516 of file suite.h.

◆ unexpected() [2/2]

template<class Condition>
bool beast::unit_test::Suite::unexpected ( Condition shouldBeFalse)
inherited

Definition at line 321 of file suite.h.

◆ pThisSuite()

Suite ** beast::unit_test::Suite::pThisSuite ( )
staticprivateinherited

Definition at line 330 of file suite.h.

◆ propagateAbort()

void beast::unit_test::Suite::propagateAbort ( ) const
privateinherited

Definition at line 560 of file suite.h.

Member Data Documentation

◆ all_

FeatureBitset const xrpl::test::LoanBroker_test::all_
private
Initial value:
{
jtx::testableAmendments() - featureLendingProtocolV1_1 - featureLendingProtocolV1_2,
}
FeatureBitset testableAmendments()
Definition Env.h:92

Definition at line 82 of file LoanBroker_test.cpp.

◆ abort_

bool beast::unit_test::Suite::abort_ = false
privateinherited

Definition at line 54 of file suite.h.

◆ aborted_

bool beast::unit_test::Suite::aborted_ = false
privateinherited

Definition at line 55 of file suite.h.

◆ runner_

Runner* beast::unit_test::Suite::runner_ = nullptr
privateinherited

Definition at line 56 of file suite.h.

◆ log

LogOs<char> beast::unit_test::Suite::log
inherited

Logging output stream.

Text sent to the log output stream will be forwarded to the output stream associated with the runner.

Definition at line 150 of file suite.h.

◆ testcase

TestcaseT beast::unit_test::Suite::testcase
inherited

Memberspace for declaring test cases.

Definition at line 155 of file suite.h.