Testing features#75
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR exposes testing features from the geo_filters crate to support internal usage and improves test determinism. The changes make testing utilities available through feature flags and add serialization support.
- Exposed testing functions (
pseudorandom_filter,iter_ones,from_ones) viatest-supportfeature - Added
serdesupport forSimHashto enable serialization of structures containingSimHash - Migrated from
StdRngtoChaCha12Rngfor deterministic test seeding across Rust versions
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/geo_filters/Cargo.toml |
Added test-support and serde features with dependencies |
crates/geo_filters/src/test_rng.rs |
Migrated from StdRng to ChaCha12Rng for deterministic seeding |
crates/geo_filters/src/diff_count/sim_hash.rs |
Made constants public and added serde support |
crates/geo_filters/src/diff_count.rs |
Exposed testing functions and moved helper methods from tests |
crates/geo_filters/src/config/lookup.rs |
Updated test functions to use ChaCha12Rng |
crates/geo_filters/src/config.rs |
Updated test functions to use ChaCha12Rng |
Comments suppressed due to low confidence (2)
crates/geo_filters/src/diff_count.rs:344
- [nitpick] The parameter name 'ones' is ambiguous. Consider renaming it to 'set_bits' or 'indices' to clarify that it represents the positions of bits to set.
pub fn from_ones(config: C, ones: impl IntoIterator<Item = C::BucketType>) -> Self {
crates/geo_filters/src/diff_count.rs:361
- [nitpick] The parameter name 'items' is unclear in this context. Consider renaming it to 'num_items' or 'item_count' to better indicate it represents the number of items to generate in the filter.
pub fn pseudorandom_filter(config: C, items: usize) -> Self {
aneubeck
reviewed
Jul 30, 2025
aneubeck
approved these changes
Jul 30, 2025
aneubeck
approved these changes
Jul 30, 2025
Also change the RNG in the test_rng harness to use chacha12 since that's portable.
Provide new impls for GeoDiffCount with C: Default, allowing construction from bytes, ones, or pseudorandom data without explicitly passing config. Update tests to use these new constructors.
e9de04e to
9e717e7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
There are some features we need exposed from the
geo_filterscrate to support internal usage.Changes
pseudorandom_filter,iter_ones,from_ones.serdedependency forSimHashes so people who are serializing structures which use aSimHashcan do that without wrapping out types or anything.rand_chachasince it is in our dependency tree now (it was before, but it wasn't being used anywhere, I suspect a copy-pasta gone awry). And this will allow test seeds to be reused across all versions of the Rust standard library.