MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_boolean_array_slice

Function test_boolean_array_slice

arrow-array/src/array/primitive_array.rs:2040–2078  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2038
2039 #[test]
2040 fn test_boolean_array_slice() {
2041 let arr = BooleanArray::from(vec![
2042 Some(true),
2043 None,
2044 Some(false),
2045 None,
2046 Some(true),
2047 Some(false),
2048 Some(true),
2049 Some(false),
2050 None,
2051 Some(true),
2052 ]);
2053
2054 assert_eq!(10, arr.len());
2055 assert_eq!(0, arr.offset());
2056 assert_eq!(3, arr.null_count());
2057
2058 let arr2 = arr.slice(3, 5);
2059 assert_eq!(5, arr2.len());
2060 assert_eq!(3, arr2.offset());
2061 assert_eq!(1, arr2.null_count());
2062
2063 let bool_arr = arr2.as_any().downcast_ref::<BooleanArray>().unwrap();
2064
2065 assert!(!bool_arr.is_valid(0));
2066
2067 assert!(bool_arr.is_valid(1));
2068 assert!(bool_arr.value(1));
2069
2070 assert!(bool_arr.is_valid(2));
2071 assert!(!bool_arr.value(2));
2072
2073 assert!(bool_arr.is_valid(3));
2074 assert!(bool_arr.value(3));
2075
2076 assert!(bool_arr.is_valid(4));
2077 assert!(!bool_arr.value(4));
2078 }
2079
2080 #[test]
2081 fn test_int32_fmt_debug() {

Callers

nothing calls this directly

Calls 2

sliceMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected