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

Function test_boolean_not

arrow-buffer/src/buffer/boolean.rs:961–979  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

959
960 #[test]
961 fn test_boolean_not() {
962 let offset = 0;
963 let len = 40;
964
965 let buf = Buffer::from(&[0, 1, 1, 0, 0]);
966 let boolean_buf = &BooleanBuffer::new(buf, offset, len);
967
968 let expected = BooleanBuffer::new(Buffer::from(&[255, 254, 254, 255, 255]), offset, len);
969 assert_eq!(!boolean_buf, expected);
970
971 // Demonstrate that Non-zero offsets are preserved
972 let sliced = boolean_buf.slice(3, 20);
973 let result = !&sliced;
974 assert_eq!(result.offset(), 3);
975 assert_eq!(result.len(), sliced.len());
976 for i in 0..sliced.len() {
977 assert_eq!(result.value(i), !sliced.value(i));
978 }
979 }
980
981 #[test]
982 fn test_boolean_from_slice_bool() {

Callers

nothing calls this directly

Calls 2

sliceMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected