Compare commits
No commits in common. "ebfce09c0e93c1ff96590e041bf3a9a0cd97a3fd" and "63515e2314ad5038132ef7e2e449e28063c7cfff" have entirely different histories.
ebfce09c0e
...
63515e2314
2 changed files with 0 additions and 32 deletions
|
@ -1,30 +0,0 @@
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use pyority_queue::backing::indexed::{IndexedBacking, IndexedBinaryHeap};
|
||||
|
||||
#[test]
|
||||
fn test_indexed_binary_heap_manual_creation() {
|
||||
let mut heap = IndexedBinaryHeap::new();
|
||||
heap.set(4, 0.5);
|
||||
heap.set(-3, 0.01);
|
||||
heap.set(6, 0.9);
|
||||
heap.set(1, 0.2);
|
||||
assert_eq!(heap.len(), 4);
|
||||
assert_eq!(heap.pop(), Some(-3));
|
||||
assert_eq!(heap.pop(), Some(1));
|
||||
assert_eq!(heap.pop(), Some(4));
|
||||
assert_eq!(heap.pop(), Some(6));
|
||||
assert_eq!(heap.pop(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_indexed_binary_heap_from_iter() {
|
||||
let mut heap = IndexedBinaryHeap::from_iter(vec![("c", 7), ("a", 3), ("b", 6), ("d", 9)]);
|
||||
assert_eq!(heap.len(), 4);
|
||||
assert_eq!(heap.pop(), Some("a"));
|
||||
assert_eq!(heap.pop(), Some("b"));
|
||||
assert_eq!(heap.pop(), Some("c"));
|
||||
assert_eq!(heap.pop(), Some("d"));
|
||||
assert_eq!(heap.pop(), None);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ mod tests {
|
|||
heap.add(-3);
|
||||
heap.add(6);
|
||||
heap.add(1);
|
||||
assert_eq!(heap.len(), 4);
|
||||
assert_eq!(heap.pop(), Some(-3));
|
||||
assert_eq!(heap.pop(), Some(1));
|
||||
assert_eq!(heap.pop(), Some(4));
|
||||
|
@ -20,7 +19,6 @@ mod tests {
|
|||
#[test]
|
||||
fn test_pure_binary_heap_from_iter() {
|
||||
let mut heap = BinaryHeap::from_iter(vec![7, 3, 6, 9]);
|
||||
assert_eq!(heap.len(), 4);
|
||||
assert_eq!(heap.pop(), Some(3));
|
||||
assert_eq!(heap.pop(), Some(6));
|
||||
assert_eq!(heap.pop(), Some(7));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue