2026-09-24 20:44:07 -06:00
|
|
|
#include <cstdint>
|
2026-09-24 14:08:32 -06:00
|
|
|
#include <iostream>
|
2026-09-24 20:44:07 -06:00
|
|
|
#include <limits>
|
2026-09-24 14:08:32 -06:00
|
|
|
|
|
|
|
|
#include "dpf.hpp"
|
|
|
|
|
|
2026-09-24 20:44:07 -06:00
|
|
|
/// Every input of the domain, from `numeric_limits<Input>::min()` through
|
|
|
|
|
/// `max()`. Same shape as `eval_interval`.
|
|
|
|
|
int main()
|
2026-09-24 14:08:32 -06:00
|
|
|
{
|
2026-09-24 20:44:07 -06:00
|
|
|
const std::uint8_t alpha = 42;
|
|
|
|
|
const std::uint64_t beta = 7;
|
|
|
|
|
auto [k0, k1] = dpf::make_dpf(alpha, beta);
|
2026-09-24 14:08:32 -06:00
|
|
|
|
2026-09-24 20:44:07 -06:00
|
|
|
//! [eval-full]
|
|
|
|
|
auto [buf0, iter0] = dpf::eval_full(k0);
|
|
|
|
|
auto [buf1, iter1] = dpf::eval_full(k1);
|
|
|
|
|
|
|
|
|
|
auto it0 = std::begin(iter0);
|
|
|
|
|
auto it1 = std::begin(iter1);
|
|
|
|
|
for (int x = std::numeric_limits<std::uint8_t>::min();
|
|
|
|
|
x <= std::numeric_limits<std::uint8_t>::max();
|
|
|
|
|
++x, ++it0, ++it1)
|
|
|
|
|
{
|
|
|
|
|
std::uint64_t got = dpf::reconstruct(*it0, *it1);
|
|
|
|
|
std::uint64_t expect = (static_cast<std::uint8_t>(x) == alpha) ? beta : 0;
|
|
|
|
|
if (got != expect)
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "eval_full\n";
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//! [eval-full]
|
|
|
|
|
if (it0 != std::end(iter0) || it1 != std::end(iter1))
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "eval_full length\n";
|
|
|
|
|
return 1;
|
2026-09-24 14:08:32 -06:00
|
|
|
}
|
|
|
|
|
|
2026-09-24 20:44:07 -06:00
|
|
|
std::cout << beta << "\n";
|
|
|
|
|
(void)buf0;
|
|
|
|
|
(void)buf1;
|
2026-09-24 14:08:32 -06:00
|
|
|
return 0;
|
2026-09-24 20:44:07 -06:00
|
|
|
}
|