Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Reduced size of test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Aug 17, 2021
1 parent 80f11f7 commit 64d564b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 43 deletions.
30 changes: 30 additions & 0 deletions tests/it/bitmap/utils/slice_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use rand::distributions::{Bernoulli, Uniform};
use rand::prelude::StdRng;
use rand::Rng;
use rand::SeedableRng;

use arrow2::bitmap::utils::SlicesIterator;
use arrow2::bitmap::Bitmap;

Expand Down Expand Up @@ -137,3 +142,28 @@ fn remainder_1() {
let chunks = iter.collect::<Vec<_>>();
assert_eq!(chunks, vec![(2, 1), (4, 1)]);
}

#[test]
fn filter_slices() {
let mut rng = StdRng::seed_from_u64(42);
let length = 500;

let mask: Bitmap = (0..length)
.map(|_| {
let v: bool = (&mut rng).sample(Bernoulli::new(0.5).unwrap());
v
})
.collect();

for offset in 100usize..(length - 1) {
let len = (&mut rng).sample(Uniform::new(0, length - offset));
let mask_s = mask.clone().slice(offset, len);

let iter = SlicesIterator::new(&mask_s);
iter.for_each(|(start, slice_len)| {
if start + slice_len > len {
panic!("Fail")
}
});
}
}
43 changes: 0 additions & 43 deletions tests/it/filter.rs

This file was deleted.

0 comments on commit 64d564b

Please sign in to comment.