xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
tests
libxrpl
ledger
RippleStateEntry.cpp
1
#include <xrpl/ledger/entries/RippleStateEntry.h>
2
3
#include <xrpl/protocol/Indexes.h>
4
#include <xrpl/protocol/Keylet.h>
5
#include <xrpl/protocol/UintTypes.h>
6
7
#include <gtest/gtest.h>
8
#include <helpers/IOU.h>
9
#include <ledger/EntryTestHelpers.h>
10
11
namespace
xrpl::test
{
12
13
TEST
(RippleStateEntryTests, constructors)
14
{
15
EntryTestEnv
e;
16
17
IOU
const
usd(
"USD"
, e.
alice
);
18
Currency
const
currency = usd.
currency
();
19
20
expectKeylet<RippleStateEntry>
(
21
e,
22
keylet::trustLine
(e.
alice
.
id
(), e.
bob
.
id
(), currency),
23
"trustLine(id0, id1, currency)"
,
24
e.
alice
.
id
(),
25
e.
bob
.
id
(),
26
currency);
27
28
expectKeylet<RippleStateEntry>
(
29
e,
30
keylet::trustLine
(e.
bob
.
id
(), usd.
issue
()),
31
"trustLine(id, issue)"
,
32
e.
bob
.
id
(),
33
usd.
issue
());
34
35
// Trust lines are deliberately symmetric in their two accounts -- the
36
// keylet canonicalizes them -- so unlike the other two-account entries
37
// there is no transposition to catch here.
38
EXPECT_EQ(
39
keylet::trustLine
(e.
alice
.
id
(), e.
bob
.
id
(), currency).key,
40
keylet::trustLine
(e.
bob
.
id
(), e.
alice
.
id
(), currency).key);
41
}
42
43
}
// namespace xrpl::test
xrpl::test::EntryTestEnv
Scaffolding shared by the per-entry-type suites.
Definition
EntryTestHelpers.h:28
xrpl::test::EntryTestEnv::alice
Account const alice
Definition
EntryTestHelpers.h:31
xrpl::test::EntryTestEnv::bob
Account const bob
Definition
EntryTestHelpers.h:32
xrpl::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition
jtx/Account.h:104
xrpl::test::jtx::IOU
Converts to IOU Issue or STAmount.
Definition
src/test/jtx/amount.h:404
xrpl::test::jtx::IOU::currency
xrpl::Currency currency
Definition
src/test/jtx/amount.h:407
xrpl::test::jtx::IOU::issue
Issue issue() const
Definition
src/test/jtx/amount.h:415
xrpl::keylet::trustLine
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Definition
Indexes.cpp:275
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
xrpl::Currency
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition
UintTypes.h:42
Generated by
1.17.0