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

Function test_boolean_data_equality

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

Source from the content-addressed store, hash-verified

828
829 #[test]
830 fn test_boolean_data_equality() {
831 let boolean_buf1 = BooleanBuffer::new(Buffer::from(&[0, 1, 4, 3, 5]), 0, 32);
832 let boolean_buf2 = BooleanBuffer::new(Buffer::from(&[0, 1, 4, 3, 5]), 0, 32);
833 assert_eq!(boolean_buf1, boolean_buf2);
834
835 // slice with same offset and same length should still preserve equality
836 let boolean_buf3 = boolean_buf1.slice(8, 16);
837 assert_ne!(boolean_buf1, boolean_buf3);
838 let boolean_buf4 = boolean_buf1.slice(0, 32);
839 assert_eq!(boolean_buf1, boolean_buf4);
840
841 // unequal because of different elements
842 let boolean_buf2 = BooleanBuffer::new(Buffer::from(&[0, 0, 2, 3, 4]), 0, 32);
843 assert_ne!(boolean_buf1, boolean_buf2);
844
845 // unequal because of different length
846 let boolean_buf2 = BooleanBuffer::new(Buffer::from(&[0, 1, 4, 3, 5]), 0, 24);
847 assert_ne!(boolean_buf1, boolean_buf2);
848
849 // ptr_eq
850 assert!(boolean_buf1.ptr_eq(&boolean_buf1));
851 assert!(boolean_buf2.ptr_eq(&boolean_buf2));
852 assert!(!boolean_buf1.ptr_eq(&boolean_buf2));
853 }
854
855 #[test]
856 fn test_boolean_slice() {

Callers

nothing calls this directly

Calls 1

sliceMethod · 0.45

Tested by

no test coverage detected