This is an automated email from the ASF dual-hosted git repository. leerho pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
commit cb9d6aba323c1272e40e1e0c3a9cb07033acb53c Merge: 16d4ea6f 185e0743 Author: Lee Rhodes <[email protected]> AuthorDate: Tue Oct 6 11:33:34 2026 -0700 Merge pull request #535 from apache/serialization-test-data-dir Move Java test fixtures to serialization_test_data/java_generated_files .github/workflows/serde_compat.yml | 8 +++++--- .gitignore | 5 ++++- cpc/test/cpc_sketch_deserialize_from_java_test.cpp | 4 ++-- fi/test/frequent_items_sketch_deserialize_from_java_test.cpp | 4 ++-- filters/test/bloom_filter_deserialize_from_java_test.cpp | 4 ++-- hll/test/hll_sketch_deserialize_from_java_test.cpp | 4 ++-- kll/test/kll_sketch_deserialize_from_java_test.cpp | 4 ++-- quantiles/test/quantiles_sketch_deserialize_from_java_test.cpp | 4 ++-- req/test/req_sketch_deserialize_from_java_test.cpp | 4 ++-- sampling/test/var_opt_sketch_deserialize_from_java_test.cpp | 4 ++-- sampling/test/var_opt_union_deserialize_from_java_test.cpp | 4 ++-- tdigest/test/tdigest_deserialize_from_java_test.cpp | 4 ++-- theta/test/theta_sketch_deserialize_from_java_test.cpp | 4 ++-- tuple/test/aod_sketch_deserialize_from_java_test.cpp | 4 ++-- tuple/test/tuple_sketch_deserialize_from_java_test.cpp | 4 ++-- 15 files changed, 35 insertions(+), 30 deletions(-) diff --cc theta/test/theta_sketch_deserialize_from_java_test.cpp index a7e4112c,8a590f87..245ddca1 --- a/theta/test/theta_sketch_deserialize_from_java_test.cpp +++ b/theta/test/theta_sketch_deserialize_from_java_test.cpp @@@ -25,30 -24,9 +25,30 @@@ namespace datasketches { // assume the binary sketches for this test have been generated by datasketches-java code - // in the subdirectory called "java" in the root directory of this project - static std::string testBinaryInputPath = std::string(TEST_BINARY_INPUT_PATH) + "../../java/"; + // in the subdirectory "serialization_test_data/java_generated_files" in the root directory of this project + static std::string testBinaryInputPath = std::string(TEST_BINARY_INPUT_PATH) + "../../serialization_test_data/java_generated_files/"; +static std::vector<uint8_t> read_java_bytes(const std::string& file_name) { + std::ifstream is(testBinaryInputPath + file_name, std::ios::binary | std::ios::ate); + is.exceptions(std::ios::failbit | std::ios::badbit); + const auto size = is.tellg(); + std::vector<uint8_t> bytes(static_cast<size_t>(size)); + is.seekg(0); + is.read(reinterpret_cast<char*>(bytes.data()), size); + return bytes; +} + +static compact_theta_sketch deserialize_java_stream(const std::string& file_name) { + std::ifstream is(testBinaryInputPath + file_name, std::ios::binary); + is.exceptions(std::ios::failbit | std::ios::badbit); + return compact_theta_sketch::deserialize(is); +} + +template<typename Vector> +static std::vector<uint8_t> to_std_vector(const Vector& bytes) { + return std::vector<uint8_t>(bytes.begin(), bytes.end()); +} + TEST_CASE("theta sketch", "[serde_compat]") { const unsigned n_arr[] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000}; for (const unsigned n: n_arr) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
