#include <catch2/catch.hpp>
#include <fstream>
#include <cpc_sketch.hpp>
namespace datasketches {
TEST_CASE("cpc sketch generate", "[serialize_for_java]") {
const unsigned n_arr[] = {0, 100, 200, 2000, 20000};
for (const unsigned n: n_arr) {
cpc_sketch sketch;
for (unsigned i = 1; i <= n; ++i) sketch.update(i);
REQUIRE(sketch.is_empty() == (n == 0));
REQUIRE(sketch.get_estimate() == Approx(n).margin(n * 0.02));
std::ofstream os("cpc_n" + std::to_string(n) + "_cpp.sk", std::ios::binary);
sketch.serialize(os);
}
}
}