MCPcopy Create free account
hub / github.com/ElementsProject/elements / CreateSketches

Function CreateSketches

src/minisketch/src/test.cpp:31–45  ·  view source on GitHub ↗

Create a vector with Minisketch objects, one for each implementation. */

Source from the content-addressed store, hash-verified

29
30/** Create a vector with Minisketch objects, one for each implementation. */
31std::vector<Minisketch> CreateSketches(uint32_t bits, size_t capacity) {
32 if (!Minisketch::BitsSupported(bits)) return {};
33 std::vector<Minisketch> ret;
34 for (uint32_t impl = 0; impl <= Minisketch::MaxImplementation(); ++impl) {
35 if (Minisketch::ImplementationSupported(bits, impl)) {
36 CHECK(Minisketch::BitsSupported(bits));
37 ret.push_back(Minisketch(bits, impl, capacity));
38 CHECK((bool)ret.back());
39 } else {
40 // implementation 0 must always work unless field size is disabled
41 CHECK(impl != 0 || !Minisketch::BitsSupported(bits));
42 }
43 }
44 return ret;
45}
46
47/** Test properties by exhaustively decoding all 2**(bits*capacity) sketches
48 * with specified capacity and bits. */

Callers 2

TestExhaustiveFunction · 0.85
TestRandomizedFunction · 0.85

Calls 2

MinisketchClass · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected