This is an automated email from the ASF dual-hosted git repository. alsay pushed a commit to branch fix_theta_compressed_stream in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
commit aac34bdbfd56d6c10c17560628d61a958b6abfa5 Author: AlexanderSaydakov <[email protected]> AuthorDate: Fri Jul 26 17:56:11 2024 -0700 cross-language test --- theta/test/theta_sketch_deserialize_from_java_test.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/theta/test/theta_sketch_deserialize_from_java_test.cpp b/theta/test/theta_sketch_deserialize_from_java_test.cpp index f69467e..691320a 100644 --- a/theta/test/theta_sketch_deserialize_from_java_test.cpp +++ b/theta/test/theta_sketch_deserialize_from_java_test.cpp @@ -45,6 +45,23 @@ TEST_CASE("theta sketch", "[serde_compat]") { } } +TEST_CASE("theta sketch compressed", "[serde_compat]") { + const unsigned n_arr[] = {10, 100, 1000, 10000, 100000, 1000000}; + for (const unsigned n: n_arr) { + std::ifstream is; + is.exceptions(std::ios::failbit | std::ios::badbit); + is.open(testBinaryInputPath + "theta_compressed_n" + std::to_string(n) + "_java.sk", std::ios::binary); + const auto sketch = compact_theta_sketch::deserialize(is); + REQUIRE(sketch.is_estimation_mode() == (n > 1000)); + REQUIRE(sketch.get_estimate() == Approx(n).margin(n * 0.03)); + for (const auto hash: sketch) { + REQUIRE(hash < sketch.get_theta64()); + } + REQUIRE(sketch.is_ordered()); + REQUIRE(std::is_sorted(sketch.begin(), sketch.end())); + } +} + TEST_CASE("theta sketch non-empty no entries", "[serde_compat]") { std::ifstream is; is.exceptions(std::ios::failbit | std::ios::badbit); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
