This is an automated email from the ASF dual-hosted git repository.

tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 36888d5  test: rework integration tests (#167)
36888d5 is described below

commit 36888d5302c5df7be3180517dfd8a64cf9f563cb
Author: tison <[email protected]>
AuthorDate: Tue Jul 28 10:55:41 2026 +0800

    test: rework integration tests (#167)
    
    Signed-off-by: tison <[email protected]>
---
 .github/workflows/ci.yml                           |   2 +-
 AGENTS.md                                          |   5 +++
 CONTRIBUTING.md                                    |  39 +++++++++++++++++----
 datasketches/Cargo.toml                            |  30 ++++++++++++++++
 datasketches/tests/.gitignore                      |   1 -
 .../reference_data.rs => countmin_test/main.rs}    |  10 +-----
 .../{countmin_test.rs => countmin_test/sketch.rs}  |   2 --
 .../reference_data.rs => cpc_test/main.rs}         |  12 ++-----
 .../tests/{cpc_union_test.rs => cpc_test/union.rs} |   2 --
 .../{cpc_update_test.rs => cpc_test/update.rs}     |   2 --
 .../{cpc_wrapper_test.rs => cpc_test/wrapper.rs}   |   2 --
 .../reference_data.rs => frequencies_test/main.rs} |  10 +-----
 .../update.rs}                                     |   2 --
 .../reference_data.rs => hll_test/main.rs}         |  11 ++----
 .../tests/{hll_union_test.rs => hll_test/union.rs} |   2 --
 .../{hll_update_test.rs => hll_test/update.rs}     |   2 --
 .../serialization_data.rs => serde_tests.rs}       |  38 ++++++++++++++++++--
 datasketches/tests/serde_tests/.gitignore          |   2 ++
 .../bloom.rs}                                      |   8 ++---
 .../countmin.rs}                                   |   8 ++---
 .../cpc.rs}                                        |   8 ++---
 .../frequencies.rs}                                |   8 ++---
 .../hll.rs}                                        |   8 ++---
 .../tdigest_ref_k100_n10000_double.sk              | Bin
 .../tdigest_ref_k100_n10000_float.sk               | Bin
 .../tdigest.rs}                                    |  13 ++-----
 .../theta.rs}                                      |   8 ++---
 .../tuple.rs}                                      |   8 ++---
 .../reference_data.rs => tdigest_test/main.rs}     |  10 +-----
 .../{tdigest_test.rs => tdigest_test/sketch.rs}    |   2 --
 .../a_not_b.rs}                                    |   2 --
 .../intersection.rs}                               |   2 --
 .../reference_data.rs => theta_test/main.rs}       |  13 +++----
 .../{theta_sketch_test.rs => theta_test/sketch.rs} |   2 --
 .../{theta_union_test.rs => theta_test/union.rs}   |   2 --
 datasketches/tests/tuple_test/main.rs              |   2 --
 ...n_test_data.py => download_serde_tests_data.py} |   6 ++--
 37 files changed, 137 insertions(+), 147 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fcae649..13c665e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -93,7 +93,7 @@ jobs:
           cache-bin: "false"
       - name: Prepare test data
         shell: bash
-        run: ./tools/download_serialization_test_data.py
+        run: ./tools/download_serde_tests_data.py
       - name: Run unit tests
         shell: bash
         run: cargo x test
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..c6b6b36
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,5 @@
+# Repository instructions for agents
+
+Before planning or modifying this repository, read 
[CONTRIBUTING.md](CONTRIBUTING.md) in full and treat its build, test, 
integration-test layout, and serialization snapshot guidance as repository 
requirements.
+
+For test changes, pay particular attention to the "Integration test layout" 
and "Serialization snapshots" sections. Keep the documented workflow 
synchronized with structural changes, and run the applicable `cargo x check`, 
`cargo x test`, and `cargo x lint` commands before handing work back.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a5fe069..f2d5e15 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -47,7 +47,7 @@ Test:
 ```shell
 cargo x test
 # or
-cargo test --workspace --no-default-features
+cargo test --workspace --all-features
 ```
 
 Lint:
@@ -56,6 +56,31 @@ Lint:
 cargo x lint
 ```
 
+## Integration test layout
+
+Integration tests for the `datasketches` crate live under `datasketches/tests` 
and use two entry-point patterns.
+
+### Sketch behavior tests
+
+Non-serialization tests are grouped into one integration-test target per 
sketch. The target entry point is `datasketches/tests/<sketch>_test/main.rs`, 
with operation-specific modules such as `update.rs`, `union.rs`, or 
`intersection.rs` alongside it.
+
+Because these entry points are nested below `tests`, Cargo does not discover 
them automatically. Each new sketch target must also be registered in 
`datasketches/Cargo.toml` with its required feature:
+
+```toml
+[[test]]
+name = "tuple_test"
+path = "tests/tuple_test/main.rs"
+required-features = ["tuple"]
+```
+
+When adding a case to an existing sketch target, add it to the appropriate 
module and declare any new module from that target's `main.rs`; no Cargo 
manifest change is needed. Add another `[[test]]` entry only when introducing a 
new sketch target.
+
+### Serialization compatibility tests
+
+Cargo automatically discovers `datasketches/tests/serde_tests.rs`, which 
aggregates the sketch-specific modules under `datasketches/tests/serde_tests`. 
Each module is gated by its corresponding sketch feature in `serde_tests.rs`.
+
+To add serialization tests for another sketch, add `serde_tests/<sketch>.rs` 
and a feature-gated module declaration in `serde_tests.rs`. Do not add a 
separate `[[test]]` entry. Shared path handling belongs in `serde_tests.rs`, 
and serialization fixtures belong in the appropriate subdirectory under 
`serde_tests`.
+
 ## Manual workflow (without xtask)
 
 `cargo x lint` runs the following steps. Use these directly when you need more 
control or want to isolate failures:
@@ -85,23 +110,23 @@ cargo install taplo-cli typos-cli hawkeye
 
 ## Serialization snapshots
 
-Some tests depend on snapshot files under 
`datasketches/tests/serialization_test_data`. If they are missing, tests will 
fail. Download them with:
+Some tests depend on snapshot files under `datasketches/tests/serde_tests`. If 
they are missing, tests will fail. Download them with:
 
 ```shell
-python3 ./tools/download_serialization_test_data.py --all
+python3 ./tools/download_serde_tests_data.py --all
 ```
 
 The script downloads the latest snapshots from the `main` branch of
 [`apache/datasketches-tck`](https://github.com/apache/datasketches-tck) and 
writes them to:
 
-- `datasketches/tests/serialization_test_data/java_generated_files`
-- `datasketches/tests/serialization_test_data/cpp_generated_files`
+- `datasketches/tests/serde_tests/java_generated_files`
+- `datasketches/tests/serde_tests/cpp_generated_files`
 
 You can download them separately:
 
 ```shell
-python3 ./tools/download_serialization_test_data.py --java
-python3 ./tools/download_serialization_test_data.py --cpp
+python3 ./tools/download_serde_tests_data.py --java
+python3 ./tools/download_serde_tests_data.py --cpp
 ```
 
 The script requires Python 3 and network access.
diff --git a/datasketches/Cargo.toml b/datasketches/Cargo.toml
index 3dad132..e3bdec1 100644
--- a/datasketches/Cargo.toml
+++ b/datasketches/Cargo.toml
@@ -47,6 +47,36 @@ tdigest = []
 theta = []
 tuple = []
 
+[[test]]
+name = "countmin_test"
+path = "tests/countmin_test/main.rs"
+required-features = ["countmin"]
+
+[[test]]
+name = "cpc_test"
+path = "tests/cpc_test/main.rs"
+required-features = ["cpc"]
+
+[[test]]
+name = "frequencies_test"
+path = "tests/frequencies_test/main.rs"
+required-features = ["frequencies"]
+
+[[test]]
+name = "hll_test"
+path = "tests/hll_test/main.rs"
+required-features = ["hll"]
+
+[[test]]
+name = "tdigest_test"
+path = "tests/tdigest_test/main.rs"
+required-features = ["tdigest"]
+
+[[test]]
+name = "theta_test"
+path = "tests/theta_test/main.rs"
+required-features = ["theta"]
+
 [[test]]
 name = "tuple_test"
 path = "tests/tuple_test/main.rs"
diff --git a/datasketches/tests/.gitignore b/datasketches/tests/.gitignore
deleted file mode 100644
index 2c1198d..0000000
--- a/datasketches/tests/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-serialization_test_data
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/countmin_test/main.rs
similarity index 78%
copy from datasketches/tests/support/reference_data.rs
copy to datasketches/tests/countmin_test/main.rs
index 995be61..825a628 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/countmin_test/main.rs
@@ -15,12 +15,4 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod sketch;
diff --git a/datasketches/tests/countmin_test.rs 
b/datasketches/tests/countmin_test/sketch.rs
similarity index 99%
rename from datasketches/tests/countmin_test.rs
rename to datasketches/tests/countmin_test/sketch.rs
index fe5419b..c7e2068 100644
--- a/datasketches/tests/countmin_test.rs
+++ b/datasketches/tests/countmin_test/sketch.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "countmin")]
-
 use datasketches::countmin::CountMinSketch;
 use googletest::assert_that;
 use googletest::prelude::ge;
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/cpc_test/main.rs
similarity index 78%
copy from datasketches/tests/support/reference_data.rs
copy to datasketches/tests/cpc_test/main.rs
index 995be61..0583ff1 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/cpc_test/main.rs
@@ -15,12 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod union;
+mod update;
+mod wrapper;
diff --git a/datasketches/tests/cpc_union_test.rs 
b/datasketches/tests/cpc_test/union.rs
similarity index 99%
rename from datasketches/tests/cpc_union_test.rs
rename to datasketches/tests/cpc_test/union.rs
index ec2377c..8f871ee 100644
--- a/datasketches/tests/cpc_union_test.rs
+++ b/datasketches/tests/cpc_test/union.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "cpc")]
-
 use datasketches::cpc::CpcSketch;
 use datasketches::cpc::CpcUnion;
 use googletest::assert_that;
diff --git a/datasketches/tests/cpc_update_test.rs 
b/datasketches/tests/cpc_test/update.rs
similarity index 98%
rename from datasketches/tests/cpc_update_test.rs
rename to datasketches/tests/cpc_test/update.rs
index 8e78995..7b814f7 100644
--- a/datasketches/tests/cpc_update_test.rs
+++ b/datasketches/tests/cpc_test/update.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "cpc")]
-
 use datasketches::common::NumStdDev;
 use datasketches::cpc::CpcSketch;
 use googletest::assert_that;
diff --git a/datasketches/tests/cpc_wrapper_test.rs 
b/datasketches/tests/cpc_test/wrapper.rs
similarity index 99%
rename from datasketches/tests/cpc_wrapper_test.rs
rename to datasketches/tests/cpc_test/wrapper.rs
index 4545e20..6355ed0 100644
--- a/datasketches/tests/cpc_wrapper_test.rs
+++ b/datasketches/tests/cpc_test/wrapper.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "cpc")]
-
 use datasketches::common::NumStdDev;
 use datasketches::cpc::CpcSketch;
 use datasketches::cpc::CpcUnion;
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/frequencies_test/main.rs
similarity index 78%
copy from datasketches/tests/support/reference_data.rs
copy to datasketches/tests/frequencies_test/main.rs
index 995be61..1dea33b 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/frequencies_test/main.rs
@@ -15,12 +15,4 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod update;
diff --git a/datasketches/tests/frequencies_update_test.rs 
b/datasketches/tests/frequencies_test/update.rs
similarity index 99%
rename from datasketches/tests/frequencies_update_test.rs
rename to datasketches/tests/frequencies_test/update.rs
index 746c410..fd7203d 100644
--- a/datasketches/tests/frequencies_update_test.rs
+++ b/datasketches/tests/frequencies_test/update.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "frequencies")]
-
 use datasketches::frequencies::ErrorType;
 use datasketches::frequencies::FrequentItemsSketch;
 
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/hll_test/main.rs
similarity index 78%
copy from datasketches/tests/support/reference_data.rs
copy to datasketches/tests/hll_test/main.rs
index 995be61..e56cecc 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/hll_test/main.rs
@@ -15,12 +15,5 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod union;
+mod update;
diff --git a/datasketches/tests/hll_union_test.rs 
b/datasketches/tests/hll_test/union.rs
similarity index 99%
rename from datasketches/tests/hll_union_test.rs
rename to datasketches/tests/hll_test/union.rs
index 5bc3bb8..91080bf 100644
--- a/datasketches/tests/hll_union_test.rs
+++ b/datasketches/tests/hll_test/union.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "hll")]
-
 //! HyperLogLog Union Integration Tests
 //!
 //! These tests verify the public API behavior of HllUnion, focusing on:
diff --git a/datasketches/tests/hll_update_test.rs 
b/datasketches/tests/hll_test/update.rs
similarity index 99%
rename from datasketches/tests/hll_update_test.rs
rename to datasketches/tests/hll_test/update.rs
index 0b0d611..e72c6fc 100644
--- a/datasketches/tests/hll_update_test.rs
+++ b/datasketches/tests/hll_test/update.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "hll")]
-
 use datasketches::common::NumStdDev;
 use datasketches::hll::HllSketch;
 use datasketches::hll::HllType;
diff --git a/datasketches/tests/support/serialization_data.rs 
b/datasketches/tests/serde_tests.rs
similarity index 65%
rename from datasketches/tests/support/serialization_data.rs
rename to datasketches/tests/serde_tests.rs
index f513c44..92cdc42 100644
--- a/datasketches/tests/support/serialization_data.rs
+++ b/datasketches/tests/serde_tests.rs
@@ -18,10 +18,10 @@
 use std::path::PathBuf;
 
 pub fn serialization_test_data(sub_dir: &str, name: &str) -> PathBuf {
-    const SERDE_TEST_DATA_DIR: &str = "tests/serialization_test_data";
+    const SERDE_TESTS_DIR: &str = "tests/serde_tests";
 
     let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(SERDE_TEST_DATA_DIR)
+        .join(SERDE_TESTS_DIR)
         .join(sub_dir)
         .join(name);
 
@@ -33,7 +33,7 @@ pub fn serialization_test_data(sub_dir: &str, name: &str) -> 
PathBuf {
             run the following commands from the project root to download the 
test data files
             if they are missing:
 
-            $ ./tools/download_serialization_test_data.py
+            $ ./tools/download_serde_tests_data.py
         "#,
             path.display(),
         );
@@ -41,3 +41,35 @@ pub fn serialization_test_data(sub_dir: &str, name: &str) -> 
PathBuf {
 
     path
 }
+
+#[cfg(feature = "bloom")]
+#[path = "serde_tests/bloom.rs"]
+mod bloom;
+
+#[cfg(feature = "countmin")]
+#[path = "serde_tests/countmin.rs"]
+mod countmin;
+
+#[cfg(feature = "cpc")]
+#[path = "serde_tests/cpc.rs"]
+mod cpc;
+
+#[cfg(feature = "frequencies")]
+#[path = "serde_tests/frequencies.rs"]
+mod frequencies;
+
+#[cfg(feature = "hll")]
+#[path = "serde_tests/hll.rs"]
+mod hll;
+
+#[cfg(feature = "tdigest")]
+#[path = "serde_tests/tdigest.rs"]
+mod tdigest;
+
+#[cfg(feature = "theta")]
+#[path = "serde_tests/theta.rs"]
+mod theta;
+
+#[cfg(feature = "tuple")]
+#[path = "serde_tests/tuple.rs"]
+mod tuple;
diff --git a/datasketches/tests/serde_tests/.gitignore 
b/datasketches/tests/serde_tests/.gitignore
new file mode 100644
index 0000000..84c031c
--- /dev/null
+++ b/datasketches/tests/serde_tests/.gitignore
@@ -0,0 +1,2 @@
+cpp_generated_files
+java_generated_files
diff --git a/datasketches/tests/bloom_serialization_test.rs 
b/datasketches/tests/serde_tests/bloom.rs
similarity index 97%
rename from datasketches/tests/bloom_serialization_test.rs
rename to datasketches/tests/serde_tests/bloom.rs
index f81823c..5875b1f 100644
--- a/datasketches/tests/bloom_serialization_test.rs
+++ b/datasketches/tests/serde_tests/bloom.rs
@@ -15,16 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "bloom")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
 use datasketches::bloom::BloomFilter;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_bloom_filter_file(path: PathBuf, expected_num_items: u64, 
expected_num_hashes: u16) {
     let bytes = fs::read(&path).unwrap();
diff --git a/datasketches/tests/countmin_serialization_test.rs 
b/datasketches/tests/serde_tests/countmin.rs
similarity index 94%
rename from datasketches/tests/countmin_serialization_test.rs
rename to datasketches/tests/serde_tests/countmin.rs
index a287822..49745f1 100644
--- a/datasketches/tests/countmin_serialization_test.rs
+++ b/datasketches/tests/serde_tests/countmin.rs
@@ -15,17 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "countmin")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 
 use datasketches::countmin::CountMinSketch;
 use googletest::assert_that;
 use googletest::prelude::contains_substring;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 // This test validates binary format compatibility (deserialize + byte 
round-trip) for
 // C++ Count-Min snapshots. It intentionally does not assert estimate 
equivalence against
diff --git a/datasketches/tests/cpc_serialization_test.rs 
b/datasketches/tests/serde_tests/cpc.rs
similarity index 94%
rename from datasketches/tests/cpc_serialization_test.rs
rename to datasketches/tests/serde_tests/cpc.rs
index c3ed2a9..7d90250 100644
--- a/datasketches/tests/cpc_serialization_test.rs
+++ b/datasketches/tests/serde_tests/cpc.rs
@@ -15,18 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "cpc")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
 use datasketches::cpc::CpcSketch;
 use googletest::assert_that;
 use googletest::prelude::near;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_sketch_file(path: PathBuf, expected_cardinality: usize) {
     let expected = expected_cardinality as f64;
diff --git a/datasketches/tests/frequencies_serialization_test.rs 
b/datasketches/tests/serde_tests/frequencies.rs
similarity index 98%
rename from datasketches/tests/frequencies_serialization_test.rs
rename to datasketches/tests/serde_tests/frequencies.rs
index b15c0c3..07051ba 100644
--- a/datasketches/tests/frequencies_serialization_test.rs
+++ b/datasketches/tests/serde_tests/frequencies.rs
@@ -15,11 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "frequencies")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 
 use datasketches::codec::SketchBytes;
@@ -28,7 +23,8 @@ use datasketches::error::Error;
 use datasketches::error::ErrorKind;
 use datasketches::frequencies::FrequentItemValue;
 use datasketches::frequencies::FrequentItemsSketch;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 #[derive(Debug, PartialEq, Eq, Hash)]
 struct NonCloneSerializableItem(i64);
diff --git a/datasketches/tests/hll_serialization_test.rs 
b/datasketches/tests/serde_tests/hll.rs
similarity index 98%
rename from datasketches/tests/hll_serialization_test.rs
rename to datasketches/tests/serde_tests/hll.rs
index 5097752..fb1e4fb 100644
--- a/datasketches/tests/hll_serialization_test.rs
+++ b/datasketches/tests/serde_tests/hll.rs
@@ -15,18 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "hll")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
 use datasketches::hash_value::natural_extend;
 use datasketches::hll::HllSketch;
 use datasketches::hll::HllType;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_sketch_file(path: PathBuf, expected_cardinality: usize, expected_lg_k: 
u8) {
     let expected = expected_cardinality as f64;
diff --git a/datasketches/tests/test_data/tdigest_ref_k100_n10000_double.sk 
b/datasketches/tests/serde_tests/reference_files/tdigest_ref_k100_n10000_double.sk
similarity index 100%
rename from datasketches/tests/test_data/tdigest_ref_k100_n10000_double.sk
rename to 
datasketches/tests/serde_tests/reference_files/tdigest_ref_k100_n10000_double.sk
diff --git a/datasketches/tests/test_data/tdigest_ref_k100_n10000_float.sk 
b/datasketches/tests/serde_tests/reference_files/tdigest_ref_k100_n10000_float.sk
similarity index 100%
rename from datasketches/tests/test_data/tdigest_ref_k100_n10000_float.sk
rename to 
datasketches/tests/serde_tests/reference_files/tdigest_ref_k100_n10000_float.sk
diff --git a/datasketches/tests/tdigest_serialization_test.rs 
b/datasketches/tests/serde_tests/tdigest.rs
similarity index 96%
rename from datasketches/tests/tdigest_serialization_test.rs
rename to datasketches/tests/serde_tests/tdigest.rs
index 1db9e70..bfe4d40 100644
--- a/datasketches/tests/tdigest_serialization_test.rs
+++ b/datasketches/tests/serde_tests/tdigest.rs
@@ -15,13 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "tdigest")]
-
-#[path = "support/reference_data.rs"]
-mod reference_data;
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
@@ -29,8 +22,8 @@ use datasketches::tdigest::TDigestMut;
 use googletest::assert_that;
 use googletest::prelude::eq;
 use googletest::prelude::near;
-use reference_data::test_data;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_sketch_file(path: PathBuf, n: u64, with_buffer: bool, is_f32: bool) {
     let bytes = fs::read(&path).unwrap();
@@ -97,7 +90,7 @@ fn test_deserialize_from_reference_implementation() {
         "tdigest_ref_k100_n10000_double.sk",
         "tdigest_ref_k100_n10000_float.sk",
     ] {
-        let path = test_data(filename);
+        let path = serialization_test_data("reference_files", filename);
         let bytes = fs::read(&path).unwrap();
         let td = TDigestMut::deserialize(&bytes, false).unwrap();
         let td = td.freeze();
diff --git a/datasketches/tests/theta_serialization_test.rs 
b/datasketches/tests/serde_tests/theta.rs
similarity index 96%
rename from datasketches/tests/theta_serialization_test.rs
rename to datasketches/tests/serde_tests/theta.rs
index 0f240bc..a1206aa 100644
--- a/datasketches/tests/theta_serialization_test.rs
+++ b/datasketches/tests/serde_tests/theta.rs
@@ -15,18 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "theta")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
 use datasketches::theta::CompactThetaSketch;
 use googletest::assert_that;
 use googletest::prelude::near;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_sketch_file(path: PathBuf, expected_cardinality: usize, 
use_compressed_round_trip: bool) {
     let expected = expected_cardinality as f64;
diff --git a/datasketches/tests/tuple_serialization_test.rs 
b/datasketches/tests/serde_tests/tuple.rs
similarity index 95%
rename from datasketches/tests/tuple_serialization_test.rs
rename to datasketches/tests/serde_tests/tuple.rs
index aa5784c..00a3ca2 100644
--- a/datasketches/tests/tuple_serialization_test.rs
+++ b/datasketches/tests/serde_tests/tuple.rs
@@ -15,18 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "tuple")]
-
-#[path = "support/serialization_data.rs"]
-mod serialization_data;
-
 use std::fs;
 use std::path::PathBuf;
 
 use datasketches::tuple::CompactTupleSketch;
 use googletest::assert_that;
 use googletest::prelude::near;
-use serialization_data::serialization_test_data;
+
+use crate::serialization_test_data;
 
 fn test_sketch_file(path: PathBuf, expected_cardinality: usize) {
     let expected = expected_cardinality as f64;
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/tdigest_test/main.rs
similarity index 78%
copy from datasketches/tests/support/reference_data.rs
copy to datasketches/tests/tdigest_test/main.rs
index 995be61..825a628 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/tdigest_test/main.rs
@@ -15,12 +15,4 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod sketch;
diff --git a/datasketches/tests/tdigest_test.rs 
b/datasketches/tests/tdigest_test/sketch.rs
similarity index 99%
rename from datasketches/tests/tdigest_test.rs
rename to datasketches/tests/tdigest_test/sketch.rs
index cce2130..b61d779 100644
--- a/datasketches/tests/tdigest_test.rs
+++ b/datasketches/tests/tdigest_test/sketch.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "tdigest")]
-
 use datasketches::tdigest::TDigestMut;
 use googletest::assert_that;
 use googletest::prelude::eq;
diff --git a/datasketches/tests/theta_a_not_b_test.rs 
b/datasketches/tests/theta_test/a_not_b.rs
similarity index 99%
rename from datasketches/tests/theta_a_not_b_test.rs
rename to datasketches/tests/theta_test/a_not_b.rs
index 1e0c0a3..e55f411 100644
--- a/datasketches/tests/theta_a_not_b_test.rs
+++ b/datasketches/tests/theta_test/a_not_b.rs
@@ -20,8 +20,6 @@
 //!
 //! The result of `a and not b` retains the keys of `a` that are absent from 
`b`.
 
-#![cfg(feature = "theta")]
-
 use datasketches::theta::CompactThetaSketch;
 use datasketches::theta::ThetaANotB;
 use datasketches::theta::ThetaSketch;
diff --git a/datasketches/tests/theta_intersection_test.rs 
b/datasketches/tests/theta_test/intersection.rs
similarity index 99%
rename from datasketches/tests/theta_intersection_test.rs
rename to datasketches/tests/theta_test/intersection.rs
index 1b961c5..21d32c5 100644
--- a/datasketches/tests/theta_intersection_test.rs
+++ b/datasketches/tests/theta_test/intersection.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "theta")]
-
 use datasketches::theta::CompactThetaSketch;
 use datasketches::theta::ThetaIntersection;
 use datasketches::theta::ThetaSketch;
diff --git a/datasketches/tests/support/reference_data.rs 
b/datasketches/tests/theta_test/main.rs
similarity index 78%
rename from datasketches/tests/support/reference_data.rs
rename to datasketches/tests/theta_test/main.rs
index 995be61..f3d4a72 100644
--- a/datasketches/tests/support/reference_data.rs
+++ b/datasketches/tests/theta_test/main.rs
@@ -15,12 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::PathBuf;
-
-pub fn test_data(name: &str) -> PathBuf {
-    const TEST_DATA_DIR: &str = "tests/test_data";
-
-    PathBuf::from(env!("CARGO_MANIFEST_DIR"))
-        .join(TEST_DATA_DIR)
-        .join(name)
-}
+mod a_not_b;
+mod intersection;
+mod sketch;
+mod union;
diff --git a/datasketches/tests/theta_sketch_test.rs 
b/datasketches/tests/theta_test/sketch.rs
similarity index 99%
rename from datasketches/tests/theta_sketch_test.rs
rename to datasketches/tests/theta_test/sketch.rs
index b7d58ba..f99413d 100644
--- a/datasketches/tests/theta_sketch_test.rs
+++ b/datasketches/tests/theta_test/sketch.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "theta")]
-
 use datasketches::common::NumStdDev;
 use datasketches::hash_value;
 use datasketches::theta::ThetaSketchBuilder;
diff --git a/datasketches/tests/theta_union_test.rs 
b/datasketches/tests/theta_test/union.rs
similarity index 99%
rename from datasketches/tests/theta_union_test.rs
rename to datasketches/tests/theta_test/union.rs
index 453af37..56fc64d 100644
--- a/datasketches/tests/theta_union_test.rs
+++ b/datasketches/tests/theta_test/union.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#![cfg(feature = "theta")]
-
 use datasketches::theta::CompactThetaSketch;
 use datasketches::theta::ThetaSketch;
 use datasketches::theta::ThetaSketchBuilder;
diff --git a/datasketches/tests/tuple_test/main.rs 
b/datasketches/tests/tuple_test/main.rs
index 4e2ab27..f5747e9 100644
--- a/datasketches/tests/tuple_test/main.rs
+++ b/datasketches/tests/tuple_test/main.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-//! Integration tests for tuple sketches and set operations.
-
 mod a_not_b;
 mod intersection;
 mod sketch;
diff --git a/tools/download_serialization_test_data.py 
b/tools/download_serde_tests_data.py
similarity index 94%
rename from tools/download_serialization_test_data.py
rename to tools/download_serde_tests_data.py
index 275914b..a659611 100755
--- a/tools/download_serialization_test_data.py
+++ b/tools/download_serde_tests_data.py
@@ -89,10 +89,10 @@ def main():
     args = parser.parse_args()
 
     repository_root = Path(__file__).resolve().parents[1]
-    serialization_test_data = repository_root / "datasketches" / "tests" / 
"serialization_test_data"
+    serde_tests = repository_root / "datasketches" / "tests" / "serde_tests"
     generated_targets = {
-        "cpp": serialization_test_data / "cpp_generated_files",
-        "java": serialization_test_data / "java_generated_files",
+        "cpp": serde_tests / "cpp_generated_files",
+        "java": serde_tests / "java_generated_files",
     }
 
     languages = []


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to