提交 60ef6095 编写于 作者: B Brian Anderson

Add priority_queue test for unique pointers

上级 90bebe35
......@@ -201,6 +201,28 @@ fn test_push() {
assert *heap.top() == 103;
}
#[test]
fn test_push_unique() {
let mut heap = from_vec(~[~2, ~4, ~9]);
assert heap.len() == 3;
assert *heap.top() == ~9;
heap.push(~11);
assert heap.len() == 4;
assert *heap.top() == ~11;
heap.push(~5);
assert heap.len() == 5;
assert *heap.top() == ~11;
heap.push(~27);
assert heap.len() == 6;
assert *heap.top() == ~27;
heap.push(~3);
assert heap.len() == 7;
assert *heap.top() == ~27;
heap.push(~103);
assert heap.len() == 8;
assert *heap.top() == ~103;
}
#[test]
fn test_push_pop() {
let mut heap = from_vec(~[5, 5, 2, 1, 3]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册