Skip to content

Commit 06468c6

Browse files
committed
Move test helpers from tests module to main impl
1 parent ad1e547 commit 06468c6

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

crates/geo_filters/src/diff_count.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,20 @@ impl<'a, C: GeoConfig<Diff>> GeoDiffCount<'a, C> {
338338
bytes_written += self.lsb.write(writer)?;
339339
Ok(bytes_written)
340340
}
341+
342+
#[cfg(test)]
343+
pub fn from_ones(config: C, ones: impl IntoIterator<Item = C::BucketType>) -> Self {
344+
let mut result = Self::new(config);
345+
for one in ones {
346+
result.xor_bit(one);
347+
}
348+
result
349+
}
350+
351+
#[cfg(test)]
352+
pub fn iter_ones(&self) -> impl Iterator<Item = C::BucketType> + '_ {
353+
iter_ones(self.bit_chunks().peekable()).map(C::BucketType::from_usize)
354+
}
341355
}
342356

343357
/// Applies a repeated bit mask to the underlying filter.
@@ -423,7 +437,7 @@ mod tests {
423437

424438
use crate::{
425439
build_hasher::UnstableDefaultBuildHasher,
426-
config::{iter_ones, tests::test_estimate, FixedConfig},
440+
config::{tests::test_estimate, FixedConfig},
427441
test_rng::prng_test_harness,
428442
};
429443

@@ -626,20 +640,6 @@ mod tests {
626640
assert_eq!(vec![17, 11, 7], a.msb.iter().copied().collect_vec());
627641
}
628642

629-
impl<C: GeoConfig<Diff>> GeoDiffCount<'_, C> {
630-
fn from_ones(config: C, ones: impl IntoIterator<Item = C::BucketType>) -> Self {
631-
let mut result = Self::new(config);
632-
for one in ones {
633-
result.xor_bit(one);
634-
}
635-
result
636-
}
637-
638-
fn iter_ones(&self) -> impl Iterator<Item = C::BucketType> + '_ {
639-
iter_ones(self.bit_chunks().peekable()).map(C::BucketType::from_usize)
640-
}
641-
}
642-
643643
#[test]
644644
fn test_serialization_empty() {
645645
let before = GeoDiffCount7::default();

0 commit comments

Comments
 (0)