mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Format first-party source according to .clang-format
This commit is contained in:
committed by
manojsdoshi
parent
65dfc5d19e
commit
50760c6935
@@ -19,8 +19,8 @@
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -36,14 +36,15 @@ class SkipList_test : public beast::unit_test::suite
|
||||
{
|
||||
Config config;
|
||||
auto prev = std::make_shared<Ledger>(
|
||||
create_genesis, config,
|
||||
std::vector<uint256>{}, env.app().family());
|
||||
create_genesis,
|
||||
config,
|
||||
std::vector<uint256>{},
|
||||
env.app().family());
|
||||
history.push_back(prev);
|
||||
for (auto i = 0; i < 1023; ++i)
|
||||
{
|
||||
auto next = std::make_shared<Ledger>(
|
||||
*prev,
|
||||
env.app().timeKeeper().closeTime());
|
||||
*prev, env.app().timeKeeper().closeTime());
|
||||
next->updateSkipList();
|
||||
history.push_back(next);
|
||||
prev = next;
|
||||
@@ -52,61 +53,58 @@ class SkipList_test : public beast::unit_test::suite
|
||||
|
||||
{
|
||||
auto l = *(std::next(std::begin(history)));
|
||||
BEAST_EXPECT((*std::begin(history))->info().seq <
|
||||
l->info().seq);
|
||||
BEAST_EXPECT(hashOfSeq(*l, l->info().seq + 1,
|
||||
env.journal) == boost::none);
|
||||
BEAST_EXPECT(hashOfSeq(*l, l->info().seq,
|
||||
env.journal) == l->info().hash);
|
||||
BEAST_EXPECT(hashOfSeq(*l, l->info().seq - 1,
|
||||
env.journal) == l->info().parentHash);
|
||||
BEAST_EXPECT(hashOfSeq(*history.back(),
|
||||
l->info().seq, env.journal) == boost::none);
|
||||
BEAST_EXPECT((*std::begin(history))->info().seq < l->info().seq);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(*l, l->info().seq + 1, env.journal) == boost::none);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(*l, l->info().seq, env.journal) == l->info().hash);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(*l, l->info().seq - 1, env.journal) ==
|
||||
l->info().parentHash);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(*history.back(), l->info().seq, env.journal) ==
|
||||
boost::none);
|
||||
}
|
||||
|
||||
// ledger skip lists store up to the previous 256 hashes
|
||||
for (auto i = history.crbegin();
|
||||
i != history.crend(); i += 256)
|
||||
for (auto i = history.crbegin(); i != history.crend(); i += 256)
|
||||
{
|
||||
for (auto n = i;
|
||||
n != std::next(i,
|
||||
(*i)->info().seq - 256 > 1 ? 257 : 256);
|
||||
++n)
|
||||
n != std::next(i, (*i)->info().seq - 256 > 1 ? 257 : 256);
|
||||
++n)
|
||||
{
|
||||
BEAST_EXPECT(hashOfSeq(**i,
|
||||
(*n)->info().seq, env.journal) ==
|
||||
(*n)->info().hash);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(**i, (*n)->info().seq, env.journal) ==
|
||||
(*n)->info().hash);
|
||||
}
|
||||
|
||||
// edge case accessing beyond 256
|
||||
BEAST_EXPECT(hashOfSeq(**i,
|
||||
(*i)->info().seq - 258, env.journal) ==
|
||||
boost::none);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(**i, (*i)->info().seq - 258, env.journal) ==
|
||||
boost::none);
|
||||
}
|
||||
|
||||
// every 256th hash beyond the first 256 is stored
|
||||
for (auto i = history.crbegin();
|
||||
i != std::next(history.crend(), -512);
|
||||
i += 256)
|
||||
for (auto i = history.crbegin(); i != std::next(history.crend(), -512);
|
||||
i += 256)
|
||||
{
|
||||
for (auto n = std::next(i, 512);
|
||||
n != history.crend();
|
||||
n += 256)
|
||||
for (auto n = std::next(i, 512); n != history.crend(); n += 256)
|
||||
{
|
||||
BEAST_EXPECT(hashOfSeq(**i,
|
||||
(*n)->info().seq, env.journal) ==
|
||||
(*n)->info().hash);
|
||||
BEAST_EXPECT(
|
||||
hashOfSeq(**i, (*n)->info().seq, env.journal) ==
|
||||
(*n)->info().hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void run() override
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testSkipList();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(SkipList,ledger,ripple);
|
||||
BEAST_DEFINE_TESTSUITE(SkipList, ledger, ripple);
|
||||
|
||||
} // test
|
||||
} // ripple
|
||||
} // namespace test
|
||||
} // namespace ripple
|
||||
|
||||
Reference in New Issue
Block a user