xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
tests
libxrpl
ledger
CredentialEntry.cpp
1
#include <xrpl/ledger/entries/CredentialEntry.h>
2
3
#include <xrpl/basics/Slice.h>
4
#include <xrpl/protocol/Indexes.h>
5
#include <xrpl/protocol/Keylet.h>
6
7
#include <gtest/gtest.h>
8
#include <ledger/EntryTestHelpers.h>
9
10
#include <
string
>
11
12
namespace
xrpl::test
{
13
14
TEST
(CredentialEntryTests, constructors)
15
{
16
EntryTestEnv
e;
17
18
std::string
const
credTypeStr =
"termsandconditions"
;
19
Slice
const
credType =
makeSlice
(credTypeStr);
20
21
expectKeylet<CredentialEntry>
(
22
e,
23
keylet::credential
(e.
alice
.
id
(), e.
bob
.
id
(), credType),
24
"credential(subject, issuer, credType)"
,
25
e.
alice
.
id
(),
26
e.
bob
.
id
(),
27
credType);
28
29
expectKeylet<CredentialEntry>
(
30
e,
keylet::credential
(e.
someID
()),
"credential(UInt256)"
, e.
someID
());
31
32
// Subject and issuer are both AccountIDs, so the assertion above only
33
// has teeth if their order matters.
34
EXPECT_NE(
35
keylet::credential
(e.
alice
.
id
(), e.
bob
.
id
(), credType).key,
36
keylet::credential
(e.
bob
.
id
(), e.
alice
.
id
(), credType).key);
37
}
38
39
}
// namespace xrpl::test
std::string
xrpl::Slice
An immutable linear range of bytes.
Definition
Slice.h:28
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::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::keylet::credential
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Definition
Indexes.cpp:585
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::makeSlice
Slice makeSlice(std::array< T, N > const &a)
Definition
Slice.h:228
string
Generated by
1.17.0