use tlid::{Pool, UnChecked}; #[test] fn check_overflow() { let mut pool = Pool::>::new(1..4); assert_eq!(pool.next(), 1); assert_eq!(pool.next(), 2); assert_eq!(pool.next(), 3); assert_eq!(pool.next(), 4); assert_eq!(pool.next(), 5); } #[test] #[ignore] fn check_overflow_u8() { let mut pool = Pool::>::new(254..255); assert_eq!(pool.next(), 254); assert_eq!(pool.next(), 255); assert_eq!(pool.next(), 0); assert_eq!(pool.next(), 1); } #[test] #[should_panic] fn check_overflow_lower() { let mut pool = Pool::>::new(100..99); assert_eq!(pool.next(), 100); assert_eq!(pool.next(), 101); } #[test] #[should_panic] fn check_overflow_same() { let mut pool = Pool::>::new(100..100); assert_eq!(pool.next(), 100); assert_eq!(pool.next(), 101); } #[test] #[should_panic] fn check_overflow_one() { let mut pool = Pool::>::new(100..101); assert_eq!(pool.next(), 100); assert_eq!(pool.next(), 101); }