use std::cmp::Reverse;
use fpq::PriorityQueue;
fn main() {
let score_fn = Box::new(|s: &String| s.len());
let mut queue = PriorityQueue::new(score_fn);
assert!(queue.peek().is_none());
queue.push("a".to_string()); queue.push("ccc".to_string()); queue.push("bb".to_string());
queue.push_with_score("b".to_string(), 10);
assert_eq!(queue.peek(), Some((10, &"b".to_string())));
assert_eq!(queue.pop(), Some((10, "b".to_string())));
assert_eq!(queue.pop(), Some((3, "ccc".to_string())));
assert_eq!(queue.pop(), Some((2, "bb".to_string())));
assert_eq!(queue.pop(), Some((1, "a".to_string())));
assert!(queue.peek().is_none());
let score_fn = Box::new(|s: &String| Reverse(s.len()));
let mut queue = PriorityQueue::new(score_fn);
queue.push("a".to_string()); queue.push("ccc".to_string()); queue.push("bb".to_string());
queue.push_with_score("b".to_string(), Reverse(10));
assert_eq!(queue.peek(), Some((Reverse(1), &"a".to_string())));
assert_eq!(queue.pop(), Some((Reverse(1), "a".to_string())));
assert_eq!(queue.pop(), Some((Reverse(2), "bb".to_string())));
assert_eq!(queue.pop(), Some((Reverse(3), "ccc".to_string())));
assert_eq!(queue.pop(), Some((Reverse(10), "b".to_string())));
assert!(queue.peek().is_none());
}