()
| 257 | |
| 258 | #[test] |
| 259 | fn test_binary_array_with_offsets() { |
| 260 | let values: [u8; 12] = [ |
| 261 | b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't', |
| 262 | ]; |
| 263 | let offsets: [i32; 4] = [0, 5, 5, 12]; |
| 264 | |
| 265 | // Test binary array with offset |
| 266 | let array_data = ArrayData::builder(DataType::Binary) |
| 267 | .len(2) |
| 268 | .offset(1) |
| 269 | .add_buffer(Buffer::from_slice_ref(offsets)) |
| 270 | .add_buffer(Buffer::from_slice_ref(values)) |
| 271 | .build() |
| 272 | .unwrap(); |
| 273 | let binary_array = BinaryArray::from(array_data); |
| 274 | assert_eq!( |
| 275 | [b'p', b'a', b'r', b'q', b'u', b'e', b't'], |
| 276 | binary_array.value(1) |
| 277 | ); |
| 278 | assert_eq!(5, binary_array.value_offsets()[0]); |
| 279 | assert_eq!(0, binary_array.value_length(0)); |
| 280 | assert_eq!(5, binary_array.value_offsets()[1]); |
| 281 | assert_eq!(7, binary_array.value_length(1)); |
| 282 | } |
| 283 | |
| 284 | #[test] |
| 285 | fn test_large_binary_array() { |
nothing calls this directly
no test coverage detected