Skip to content

Commit 60ef609

Browse files
committed
Add priority_queue test for unique pointers
1 parent 90bebe3 commit 60ef609

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/libstd/priority_queue.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,28 @@ mod tests {
201201
assert *heap.top() == 103;
202202
}
203203

204+
#[test]
205+
fn test_push_unique() {
206+
let mut heap = from_vec(~[~2, ~4, ~9]);
207+
assert heap.len() == 3;
208+
assert *heap.top() == ~9;
209+
heap.push(~11);
210+
assert heap.len() == 4;
211+
assert *heap.top() == ~11;
212+
heap.push(~5);
213+
assert heap.len() == 5;
214+
assert *heap.top() == ~11;
215+
heap.push(~27);
216+
assert heap.len() == 6;
217+
assert *heap.top() == ~27;
218+
heap.push(~3);
219+
assert heap.len() == 7;
220+
assert *heap.top() == ~27;
221+
heap.push(~103);
222+
assert heap.len() == 8;
223+
assert *heap.top() == ~103;
224+
}
225+
204226
#[test]
205227
fn test_push_pop() {
206228
let mut heap = from_vec(~[5, 5, 2, 1, 3]);

0 commit comments

Comments
 (0)