xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
tests
libxrpl
ledger
DirectoryNodeEntry.cpp
1
#include <xrpl/ledger/entries/DirectoryNodeEntry.h>
2
3
#include <xrpl/protocol/Indexes.h>
4
#include <xrpl/protocol/Keylet.h>
5
6
#include <gtest/gtest.h>
7
#include <ledger/EntryTestHelpers.h>
8
9
#include <
cstdint
>
10
11
namespace
xrpl::test
{
12
13
TEST
(DirectoryNodeEntryTests, constructors)
14
{
15
EntryTestEnv
e;
16
17
expectKeylet<DirectoryNodeEntry>
(
18
e,
keylet::ownerDir
(e.
alice
.
id
()),
"ownerDir(id)"
, e.
alice
.
id
());
19
20
expectKeylet<DirectoryNodeEntry>
(
21
e,
keylet::page
(e.
someID
(), 3u),
"page(root, index)"
, e.
someID
(),
std::uint64_t
{3});
22
23
// The two overloads reach different keylet:: functions; a copy-paste
24
// slip between them would be invisible otherwise.
25
EXPECT_NE(
keylet::ownerDir
(e.
alice
.
id
()).key,
keylet::page
(e.
someID
(), 3u).key);
26
}
27
28
}
// 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::someID
UInt256 someID() const
An arbitrary but stable UInt256, for the entry constructors that take an object ID directly.
Definition
EntryTestHelpers.h:62
xrpl::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition
jtx/Account.h:104
cstdint
std::uint64_t
xrpl::keylet::ownerDir
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition
Indexes.cpp:403
xrpl::keylet::page
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition
Indexes.cpp:409
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