Skip to content

Commit b2e2a64

Browse files
committed
Rewrite test_buffer_write_unallocated() to use ring.get_unallocated() instead of comparing the buffer.
Fixtures have been shortened to work with the outstanding contiguous buffer optimization.
1 parent 4aeeac0 commit b2e2a64

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/storage/ring_buffer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,13 @@ mod test {
659659
ring.dequeue_many(6).copy_from_slice(b"ABCDEF");
660660

661661
assert_eq!(ring.write_unallocated(0, b"ghi"), 3);
662-
assert_eq!(&ring.storage[..], b"ABCDEFghi...");
662+
assert_eq!(ring.get_unallocated(0, 3), b"ghi");
663663

664664
assert_eq!(ring.write_unallocated(3, b"jklmno"), 6);
665-
assert_eq!(&ring.storage[..], b"mnoDEFghijkl");
665+
assert_eq!(ring.get_unallocated(3, 3), b"jkl");
666666

667667
assert_eq!(ring.write_unallocated(9, b"pqrstu"), 3);
668-
assert_eq!(&ring.storage[..], b"mnopqrghijkl");
668+
assert_eq!(ring.get_unallocated(9, 3), b"pqr");
669669
}
670670

671671
#[test]

0 commit comments

Comments
 (0)