xrpld
Loading...
Searching...
No Matches
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
11namespace xrpl::test {
12
13TEST(DirectoryNodeEntryTests, constructors)
14{
16
18 e, keylet::ownerDir(e.alice.id()), "ownerDir(id)", e.alice.id());
19
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
Scaffolding shared by the per-entry-type suites.
UInt256 someID() const
An arbitrary but stable UInt256, for the entry constructors that take an object ID directly.
AccountID id() const
Returns the Account ID.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition Indexes.cpp:403
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition Indexes.cpp:409
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.