count.rs 378 B

12345678910111213141516
  1. use mini_avl::Set;
  2. #[test]
  3. fn test_count() {
  4. let mut set = Set::new();
  5. for i in 1..11 {
  6. assert!(set.insert(i));
  7. assert_eq!(set.count(), i);
  8. }
  9. for i in 1..11 {
  10. assert_eq!(set.count_lt(&i), i - 1);
  11. assert_eq!(set.count_le(&i), i);
  12. assert_eq!(set.count_ge(&i), 11 - i);
  13. assert_eq!(set.count_gt(&i), 10 - i);
  14. }
  15. }