#include #include #include "dpf.hpp" /// Inclusive range. The returned iterable yields one share per input in /// `[from, to]`, in that order. int main() { const std::uint8_t alpha = 42; const std::uint64_t beta = 7; const std::uint8_t from = 40; const std::uint8_t to = 50; auto [k0, k1] = dpf::make_dpf(alpha, beta); //! [eval-interval] auto [buf0, iter0] = dpf::eval_interval(k0, from, to); auto [buf1, iter1] = dpf::eval_interval(k1, from, to); auto it0 = std::begin(iter0); auto it1 = std::begin(iter1); for (std::uint8_t x = from; x <= to; ++x, ++it0, ++it1) { std::uint64_t got = dpf::reconstruct(*it0, *it1); std::uint64_t expect = (x == alpha) ? beta : 0; if (got != expect) { std::cerr << "eval_interval\n"; return 1; } } //! [eval-interval] if (it0 != std::end(iter0) || it1 != std::end(iter1)) { std::cerr << "eval_interval length\n"; return 1; } std::cout << dpf::reconstruct(*std::begin(iter0), *std::begin(iter1)) << "\n"; (void)buf0; (void)buf1; return 0; }