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

jeffreyvo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new b318293972 Add BooleanArray tests for null and slice behavior (#9013)
b318293972 is described below

commit b31829397297e5066d91f5a106e9b3586569f8ca
Author: UtkarshSahay123 <[email protected]>
AuthorDate: Sat Dec 20 21:45:00 2025 +0530

    Add BooleanArray tests for null and slice behavior (#9013)
    
    This PR adds unit tests for BooleanArray to improve coverage of:
    
    - new_null  behavior
    - Slicing behavior when null values are present
    
    There are no functional or API changes.
    
    Tests run:
    - cargo test -p arrow-array
    
    ---------
    
    Co-authored-by: Andrew Lamb <[email protected]>
---
 arrow-array/src/array/boolean_array.rs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arrow-array/src/array/boolean_array.rs 
b/arrow-array/src/array/boolean_array.rs
index 7967084aa7..530121ea78 100644
--- a/arrow-array/src/array/boolean_array.rs
+++ b/arrow-array/src/array/boolean_array.rs
@@ -829,4 +829,32 @@ mod tests {
         assert_eq!(values.values(), &[0b1000_0000]);
         assert!(nulls.is_none());
     }
+
+    #[test]
+    fn test_new_null_array() {
+        let arr = BooleanArray::new_null(5);
+
+        assert_eq!(arr.len(), 5);
+        assert_eq!(arr.null_count(), 5);
+        assert_eq!(arr.true_count(), 0);
+        assert_eq!(arr.false_count(), 0);
+
+        for i in 0..5 {
+            assert!(arr.is_null(i));
+            assert!(!arr.is_valid(i));
+        }
+    }
+
+    #[test]
+    fn test_slice_with_nulls() {
+        let arr = BooleanArray::from(vec![Some(true), None, Some(false)]);
+        let sliced = arr.slice(1, 2);
+
+        assert_eq!(sliced.len(), 2);
+        assert_eq!(sliced.null_count(), 1);
+
+        assert!(sliced.is_null(0));
+        assert!(sliced.is_valid(1));
+        assert!(!sliced.value(1));
+    }
 }

Reply via email to