Skip to content

Commit 511252b

Browse files
bors[bot]japaric
andauthored
Merge #294
294: test BinaryHeap::into_vec r=japaric a=japaric Co-authored-by: Jorge Aparicio <[email protected]>
2 parents f07235e + 0917bcc commit 511252b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/binary_heap.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,26 @@ mod tests {
615615
assert_eq!(Droppable::count(), 0);
616616
}
617617

618+
#[test]
619+
fn into_vec() {
620+
droppable!();
621+
622+
let mut h: BinaryHeap<Droppable, Max, 2> = BinaryHeap::new();
623+
h.push(Droppable::new()).ok().unwrap();
624+
h.push(Droppable::new()).ok().unwrap();
625+
h.pop().unwrap();
626+
627+
assert_eq!(Droppable::count(), 1);
628+
629+
let v = h.into_vec();
630+
631+
assert_eq!(Droppable::count(), 1);
632+
633+
core::mem::drop(v);
634+
635+
assert_eq!(Droppable::count(), 0);
636+
}
637+
618638
#[test]
619639
fn min() {
620640
let mut heap = BinaryHeap::<_, Min, 16>::new();

0 commit comments

Comments
 (0)