xrpld
Loading...
Searching...
No Matches
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
11namespace xrpl::test {
12
13TEST(RippleStateEntryTests, constructors)
14{
16
17 IOU const usd("USD", e.alice);
18 Currency const currency = usd.currency();
19
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
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
Scaffolding shared by the per-entry-type suites.
AccountID id() const
Returns the Account ID.
Converts to IOU Issue or STAmount.
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition Indexes.cpp:275
TEST(UnitsTest, types)
Definition Units.cpp:16
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.
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:42