xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
tests
libxrpl
ledger
LoanEntry.cpp
1
#include <xrpl/ledger/entries/LoanEntry.h>
2
3
#include <xrpl/protocol/Indexes.h>
4
#include <xrpl/protocol/Keylet.h>
5
#include <xrpl/protocol/SeqProxy.h>
6
7
#include <gtest/gtest.h>
8
#include <ledger/EntryTestHelpers.h>
9
10
namespace
xrpl::test
{
11
12
TEST
(LoanEntryTests, constructors)
13
{
14
EntryTestEnv
e;
15
16
SeqProxy
const
seq =
SeqProxy::rawSequence
(9);
17
18
expectKeylet<LoanEntry>
(
19
e,
keylet::loan
(e.
someID
(), seq),
"loan(loanBrokerID, loanSeq)"
, e.
someID
(), seq);
20
21
expectKeylet<LoanEntry>
(e,
keylet::loan
(e.
someID
()),
"loan(UInt256)"
, e.
someID
());
22
23
// Both overloads start with the same UInt256, so they must not produce
24
// the same key -- otherwise arity is the only thing keeping them apart
25
// and the test proves nothing.
26
EXPECT_NE(
keylet::loan
(e.
someID
(), seq).key,
keylet::loan
(e.
someID
()).key);
27
}
28
29
}
// namespace xrpl::test
xrpl::SeqProxy
A type that represents either a sequence value or a ticket value.
Definition
SeqProxy.h:37
xrpl::SeqProxy::rawSequence
static constexpr SeqProxy rawSequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
Definition
SeqProxy.h:62
xrpl::test::EntryTestEnv
Scaffolding shared by the per-entry-type suites.
Definition
EntryTestHelpers.h:28
xrpl::test::EntryTestEnv::someID
UInt256 someID() const
An arbitrary but stable UInt256, for the entry constructors that take an object ID directly.
Definition
EntryTestHelpers.h:62
xrpl::keylet::loan
Keylet loan(UInt256 const &loanBrokerID, SeqProxy const &loanSeq) noexcept
Definition
Indexes.cpp:603
xrpl::test
Definition
STLedgerEntry.h:21
xrpl::test::TEST
TEST(UnitsTest, types)
Definition
Units.cpp:16
xrpl::test::expectKeylet
void expectKeylet(EntryTestEnv &e, Keylet const &expected, std::string const &what, Args const &... args)
Assert that both flavors of Entry built from args resolve the ledger object that expected names.
Definition
EntryTestHelpers.h:96
Generated by
1.17.0