rippled
Loading...
Searching...
No Matches
owners.cpp
1#include <test/jtx/owners.h>
2
3namespace xrpl {
4namespace detail {
5
7owned_count_of(ReadView const& view, AccountID const& id, LedgerEntryType type)
8{
9 std::uint32_t count = 0;
10 forEachItem(view, id, [&count, type](std::shared_ptr<SLE const> const& sle) {
11 if (sle->getType() == type)
12 ++count;
13 });
14 return count;
15}
16
17void
19{
20 env.test.expect(owned_count_of(*env.current(), id, type) == value);
21}
22
23} // namespace detail
24
25namespace test {
26namespace jtx {
27
28void
30{
31 env.test.expect(env.le(account_)->getFieldU32(sfOwnerCount) == value_);
32}
33
34} // namespace jtx
35} // namespace test
36} // namespace xrpl
bool expect(Condition const &shouldBeTrue)
Evaluate a test condition.
Definition suite.h:221
A view into a ledger.
Definition ReadView.h:31
A transaction testing environment.
Definition Env.h:119
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition Env.cpp:249
beast::unit_test::suite & test
Definition Env.h:121
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:319
std::uint32_t value_
Definition owners.h:51
void operator()(Env &env) const
Definition owners.cpp:29
std::uint32_t owned_count_of(ReadView const &view, AccountID const &id, LedgerEntryType type)
Definition owners.cpp:7
void owned_count_helper(test::jtx::Env &env, AccountID const &id, LedgerEntryType type, std::uint32_t value)
Definition owners.cpp:18
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
Definition View.cpp:598
LedgerEntryType
Identifiers for on-ledger objects.