13#include <boost/test/unit_test.hpp>
23constexpr std::pair<FeeFrac, TestBitSet> HOLE{
FeeFrac{0, 0x3FFFFF}, {}};
25template<
typename SetType>
26void TestDepGraphSerialization(
const std::vector<std::pair<FeeFrac, SetType>>& cluster,
const std::string& hexenc)
33 if (cluster[i] == HOLE) holes.Set(i);
42 std::vector<unsigned char> encoding;
44 writer << Using<DepGraphFormatter>(depgraph);
51 reader >> Using<DepGraphFormatter>(depgraph_read);
60 TestDepGraphSerialization<TestBitSet>(
65 TestDepGraphSerialization<TestBitSet>(
73 TestDepGraphSerialization<TestBitSet>(
74 {{{42, 11}, {}}, {{-13, 7}, {0}}},
85 TestDepGraphSerialization<TestBitSet>(
86 {{{64, 128}, {}}, {{128, 256}, {}}, {{1, 1}, {0, 1}}},
102 TestDepGraphSerialization<TestBitSet>(
103 {{{57, 114}, {1}}, {{-57, 113}, {}}, {{-58, 115}, {1}}, {{58, 116}, {2}}},
123 TestDepGraphSerialization<TestBitSet>(
124 {{{1, 3}, {1, 2}}, {{1, 2}, {}}, {{3, 1}, {}}, {{1, 1}, {0}}, {{2, 1}, {1}}},
151 TestDepGraphSerialization<TestBitSet>(
152 {HOLE, {{1, 3}, {4, 6}}, HOLE, HOLE, {{1, 2}, {}}, HOLE, {{3, 1}, {}}, HOLE, HOLE, HOLE, {{1, 1}, {1}}, HOLE, HOLE, {{2, 1}, {4}}},
Minimal stream for reading from an existing byte array by Span.
Data structure that holds a transaction graph's preprocessed data (fee, size, ancestors,...
void AddDependencies(const SetType &parents, ClusterIndex child) noexcept
Modify this transaction graph, adding multiple parents to a specified child.
void RemoveTransactions(const SetType &del) noexcept
Remove the specified positions from this DepGraph.
ClusterIndex AddTransaction(const FeeFrac &feefrac) noexcept
Add a new unconnected transaction to this transaction graph (in the first available position),...
BOOST_AUTO_TEST_CASE(depgraph_ser_tests)
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
uint32_t ClusterIndex
Data type to represent transaction indices in clusters.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
Data structure storing a fee and size, ordered by increasing fee/size.