()
| 620 | |
| 621 | #[test] |
| 622 | fn test_buffer_data_equality() { |
| 623 | let buf1 = Buffer::from(&[0, 1, 2, 3, 4]); |
| 624 | let buf2 = Buffer::from(&[0, 1, 2, 3, 4]); |
| 625 | assert_eq!(buf1, buf2); |
| 626 | |
| 627 | // slice with same offset and same length should still preserve equality |
| 628 | let buf3 = buf1.slice(2); |
| 629 | assert_ne!(buf1, buf3); |
| 630 | let buf4 = buf2.slice_with_length(2, 3); |
| 631 | assert_eq!(buf3, buf4); |
| 632 | |
| 633 | // Different capacities should still preserve equality |
| 634 | let mut buf2 = MutableBuffer::new(65); |
| 635 | buf2.extend_from_slice(&[0u8, 1, 2, 3, 4]); |
| 636 | |
| 637 | let buf2 = buf2.into(); |
| 638 | assert_eq!(buf1, buf2); |
| 639 | |
| 640 | // unequal because of different elements |
| 641 | let buf2 = Buffer::from(&[0, 0, 2, 3, 4]); |
| 642 | assert_ne!(buf1, buf2); |
| 643 | |
| 644 | // unequal because of different length |
| 645 | let buf2 = Buffer::from(&[0, 1, 2, 3]); |
| 646 | assert_ne!(buf1, buf2); |
| 647 | } |
| 648 | |
| 649 | #[test] |
| 650 | fn test_from_raw_parts() { |
nothing calls this directly
no test coverage detected