You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/15 18:39:18 UTC
[GitHub] [arrow-rs] alamb commented on a diff in pull request #3856: Add BitIterator
alamb commented on code in PR #3856:
URL: https://github.com/apache/arrow-rs/pull/3856#discussion_r1137589676
##########
arrow-data/src/bit_iterator.rs:
##########
@@ -192,4 +251,28 @@ pub fn try_for_each_valid_idx<E, F: FnMut(usize) -> Result<(), E>>(
}
}
-// Note: tests located in filter module
+// Note: further tests located in arrow_select::filter module
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_fuzz() {
+ let mask = &[0b00010010, 0b00100011, 0b00000101, 0b00010001, 0b10010011];
+ let actual: Vec<_> = BitIterator::new(mask, 0, 5).collect();
+ assert_eq!(actual, &[false, true, false, false, true]);
+
+ let actual: Vec<_> = BitIterator::new(mask, 4, 5).collect();
+ assert_eq!(actual, &[true, false, false, false, true]);
+
+ let actual: Vec<_> = BitIterator::new(mask, 12, 14).collect();
Review Comment:
I would recommend a test (that the iterator panic's) if the slice is out of bounds
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org