@@ -3086,80 +3086,6 @@ mod test_map {
30863086 assert_eq ! ( format!( "{:?}" , empty) , "{}" ) ;
30873087 }
30883088
3089- #[ test]
3090- fn test_expand ( ) {
3091- let mut m = HashMap :: new ( ) ;
3092-
3093- assert_eq ! ( m. len( ) , 0 ) ;
3094- assert ! ( m. is_empty( ) ) ;
3095-
3096- let mut i = 0 ;
3097- let old_raw_cap = m. raw_capacity ( ) ;
3098- while old_raw_cap == m. raw_capacity ( ) {
3099- m. insert ( i, i) ;
3100- i += 1 ;
3101- }
3102-
3103- assert_eq ! ( m. len( ) , i) ;
3104- assert ! ( !m. is_empty( ) ) ;
3105- }
3106-
3107- #[ test]
3108- fn test_behavior_resize_policy ( ) {
3109- let mut m = HashMap :: new ( ) ;
3110-
3111- assert_eq ! ( m. len( ) , 0 ) ;
3112- assert_eq ! ( m. raw_capacity( ) , 1 ) ;
3113- assert ! ( m. is_empty( ) ) ;
3114-
3115- m. insert ( 0 , 0 ) ;
3116- m. remove ( & 0 ) ;
3117- assert ! ( m. is_empty( ) ) ;
3118- let initial_raw_cap = m. raw_capacity ( ) ;
3119- m. reserve ( initial_raw_cap) ;
3120- let raw_cap = m. raw_capacity ( ) ;
3121-
3122- assert_eq ! ( raw_cap, initial_raw_cap * 2 ) ;
3123-
3124- let mut i = 0 ;
3125- for _ in 0 ..raw_cap * 3 / 4 {
3126- m. insert ( i, i) ;
3127- i += 1 ;
3128- }
3129- // three quarters full
3130-
3131- assert_eq ! ( m. len( ) , i) ;
3132- assert_eq ! ( m. raw_capacity( ) , raw_cap) ;
3133-
3134- for _ in 0 ..raw_cap / 4 {
3135- m. insert ( i, i) ;
3136- i += 1 ;
3137- }
3138- // half full
3139-
3140- let new_raw_cap = m. raw_capacity ( ) ;
3141- assert_eq ! ( new_raw_cap, raw_cap * 2 ) ;
3142-
3143- for _ in 0 ..raw_cap / 2 - 1 {
3144- i -= 1 ;
3145- m. remove ( & i) ;
3146- assert_eq ! ( m. raw_capacity( ) , new_raw_cap) ;
3147- }
3148- // A little more than one quarter full.
3149- m. shrink_to_fit ( ) ;
3150- assert_eq ! ( m. raw_capacity( ) , raw_cap) ;
3151- // again, a little more than half full
3152- for _ in 0 ..raw_cap / 2 {
3153- i -= 1 ;
3154- m. remove ( & i) ;
3155- }
3156- m. shrink_to_fit ( ) ;
3157-
3158- assert_eq ! ( m. len( ) , i) ;
3159- assert ! ( !m. is_empty( ) ) ;
3160- assert_eq ! ( m. raw_capacity( ) , initial_raw_cap) ;
3161- }
3162-
31633089 #[ test]
31643090 fn test_reserve_shrink_to_fit ( ) {
31653091 let mut m = HashMap :: new ( ) ;
0 commit comments