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

Function test_boolean_array_builder

arrow-array/src/array/boolean_array.rs:1047–1066  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1045
1046 #[test]
1047 fn test_boolean_array_builder() {
1048 // Test building a boolean array with ArrayData builder and offset
1049 // 000011011
1050 let buf = Buffer::from([27_u8]);
1051 let buf2 = buf.clone();
1052 let data = ArrayData::builder(DataType::Boolean)
1053 .len(5)
1054 .offset(2)
1055 .add_buffer(buf)
1056 .build()
1057 .unwrap();
1058 let arr = BooleanArray::from(data);
1059 assert_eq!(&buf2, arr.values().inner());
1060 assert_eq!(5, arr.len());
1061 assert_eq!(2, arr.offset());
1062 assert_eq!(0, arr.null_count());
1063 for i in 0..3 {
1064 assert_eq!(i != 0, arr.value(i), "failed at {i}");
1065 }
1066 }
1067
1068 #[test]
1069 #[should_panic(

Callers

nothing calls this directly

Calls 5

add_bufferMethod · 0.80
cloneMethod · 0.45
buildMethod · 0.45
offsetMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected