Add priority_queue test for unique pointers
This commit is contained in:
parent
90bebe3522
commit
60ef6095f2
1 changed files with 22 additions and 0 deletions
|
@ -201,6 +201,28 @@ mod tests {
|
||||||
assert *heap.top() == 103;
|
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]
|
#[test]
|
||||||
fn test_push_pop() {
|
fn test_push_pop() {
|
||||||
let mut heap = from_vec(~[5, 5, 2, 1, 3]);
|
let mut heap = from_vec(~[5, 5, 2, 1, 3]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue