11#include <boost/test/unit_test.hpp>
21 for (
int i = 0; i < 100; ++i) {
22 uint32_t errors = 0 + m_rng.randrange(11);
23 uint32_t start_a = 1 + m_rng.randrange(1000000000);
24 uint32_t a_not_b = m_rng.randrange(errors + 1);
25 uint32_t b_not_a = errors - a_not_b;
26 uint32_t both = m_rng.randrange(10000);
27 uint32_t end_a = start_a + a_not_b + both;
28 uint32_t start_b = start_a + a_not_b;
29 uint32_t end_b = start_b + both + b_not_a;
32 for (uint32_t a = start_a; a < end_a; ++a) sketch_a.Add(a);
34 for (uint32_t b = start_b; b < end_b; ++b) sketch_b.Add(b);
38 sketch_ar.Deserialize(sketch_a.Serialize());
39 sketch_br.Deserialize(sketch_b.Serialize());
41 Minisketch sketch_c = std::move(sketch_ar);
42 sketch_c.Merge(sketch_br);
43 auto dec = sketch_c.Decode(errors);
44 BOOST_REQUIRE(dec.has_value());
45 auto sols = std::move(*dec);
46 std::sort(sols.begin(), sols.end());
48 for (uint32_t i = 0; i < b_not_a; ++i)
BOOST_CHECK_EQUAL(sols[i + a_not_b], start_b + both + i);
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(minisketch_test)
Minisketch MakeMinisketch32(size_t capacity)
Wrapper around Minisketch::Minisketch(32, implementation, capacity).
#define BOOST_CHECK_EQUAL(v1, v2)