#![cfg(feature = "collections")] use commons::collections::*; #[test] fn test_queue() { let mut q: Queue = Queue::new(); q.push(1); assert_eq!(Some(1), q.pop()); assert_eq!(None, q.pop()); assert_eq!(0, q.len()); assert_eq!(true, q.is_empty()); q.clear(); } #[test] fn test_stack() { let mut s: Stack = Stack::new(); s.push(1); s.push(2); assert_eq!(Some(2), s.pop()); s.pop(); assert_eq!(None, s.pop()); assert_eq!(0, s.len()); assert_eq!(true, s.is_empty()); s.clear() } #[test] fn test_set() { let mut s: Set = Set::new(); assert_eq!(0, s.len()); assert_eq!(true, s.is_empty()); s.add(&[1, 2, 3]); assert_eq!(vec![1, 2, 3], s.to_vec()); assert_eq!(true, s.contain(1)); assert_eq!(false, s.contain(9)); s.delete(&[1, 2]); }