// License: see LICENSE file at root directory of `master` branch use dia_range::RangeIter; #[test] fn range_iter() { let mut iter = RangeIter::new(0, 1); assert_eq!(iter.next(), Some(0)); assert_eq!(iter.next(), Some(1)); assert_eq!(iter.next(), None); assert_eq!(iter.next_back(), None); let mut iter = RangeIter::new(0, 1); assert_eq!(iter.next_back(), Some(1)); assert_eq!(iter.next_back(), Some(0)); assert_eq!(iter.next_back(), None); assert_eq!(iter.next(), None); let mut iter = RangeIter::new(-3, 3); assert_eq!(iter.next(), Some(-3)); assert_eq!(iter.next(), Some(-2)); assert_eq!(iter.next(), Some(-1)); assert_eq!(iter.next(), Some(0)); assert_eq!(iter.next(), Some(1)); assert_eq!(iter.next_back(), Some(3)); assert_eq!(iter.next_back(), Some(2)); assert_eq!(iter.next_back(), None); assert_eq!(iter.next(), None); assert_eq!(RangeIter::new(0_u8, 3).collect::>(), (0..=3_u8).collect::>()); assert_eq!(RangeIter::new(0_u8, 3).rev().collect::>(), (0..=3_u8).rev().collect::>()); }