about summary refs log tree commit diff
path: root/src/libcollectionstest/binary_heap.rs
diff options
context:
space:
mode:
authorJohannes Oertel <johannes.oertel@uni-due.de>2015-06-03 12:38:42 +0200
committerJohannes Oertel <johannes.oertel@uni-due.de>2015-06-08 12:05:33 +0200
commitb36ed7d2edf68453c0344eb3cd55281e48c96ecb (patch)
treee1bda74459df66821d1182fb397048f24e3829fa /src/libcollectionstest/binary_heap.rs
parenta5979be9fefe671fa81ec70720234602f8112bec (diff)
downloadrust-b36ed7d2edf68453c0344eb3cd55281e48c96ecb.tar.gz
rust-b36ed7d2edf68453c0344eb3cd55281e48c96ecb.zip
Implement RFC 839
Closes #25976.
Diffstat (limited to 'src/libcollectionstest/binary_heap.rs')
-rw-r--r--src/libcollectionstest/binary_heap.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libcollectionstest/binary_heap.rs b/src/libcollectionstest/binary_heap.rs
index 47a366bb1e2..303a0ce811d 100644
--- a/src/libcollectionstest/binary_heap.rs
+++ b/src/libcollectionstest/binary_heap.rs
@@ -217,3 +217,28 @@ fn test_drain() {
 
     assert!(q.is_empty());
 }
+
+#[test]
+fn test_extend_ref() {
+    let mut a = BinaryHeap::new();
+    a.push(1);
+    a.push(2);
+
+    a.extend(&[3, 4, 5]);
+
+    assert_eq!(a.len(), 5);
+    assert_eq!(a.into_sorted_vec(), [1, 2, 3, 4, 5]);
+
+    let mut a = BinaryHeap::new();
+    a.push(1);
+    a.push(2);
+    let mut b = BinaryHeap::new();
+    b.push(3);
+    b.push(4);
+    b.push(5);
+
+    a.extend(&b);
+
+    assert_eq!(a.len(), 5);
+    assert_eq!(a.into_sorted_vec(), [1, 2, 3, 4, 5]);
+}