rippled
Loading...
Searching...
No Matches
owners.cpp
1#include <test/jtx/owners.h>
2
3namespace ripple {
4namespace detail {
5
7owned_count_of(ReadView const& view, AccountID const& id, LedgerEntryType type)
8{
9 std::uint32_t count = 0;
11 view, id, [&count, type](std::shared_ptr<SLE const> const& sle) {
12 if (sle->getType() == type)
13 ++count;
14 });
15 return count;
16}
17
18void
20 test::jtx::Env& env,
21 AccountID const& id,
22 LedgerEntryType type,
23 std::uint32_t value)
24{
25 env.test.expect(owned_count_of(*env.current(), id, type) == value);
26}
27
28} // namespace detail
29
30namespace test {
31namespace jtx {
32
33void
35{
36 env.test.expect(env.le(account_)->getFieldU32(sfOwnerCount) == value_);
37}
38
39} // namespace jtx
40} // namespace test
41} // namespace ripple
bool expect(Condition const &shouldBeTrue)
Evaluate a test condition.
Definition suite.h:226
A view into a ledger.
Definition ReadView.h:32
A transaction testing environment.
Definition Env.h:102
beast::unit_test::suite & test
Definition Env.h:104
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:312
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition Env.cpp:259
std::uint32_t value_
Definition owners.h:57
void operator()(Env &env) const
Definition owners.cpp:34
void owned_count_helper(test::jtx::Env &env, AccountID const &id, LedgerEntryType type, std::uint32_t value)
Definition owners.cpp:19
std::uint32_t owned_count_of(ReadView const &view, AccountID const &id, LedgerEntryType type)
Definition owners.cpp:7
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
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:637
LedgerEntryType
Identifiers for on-ledger objects.