Skip to content

Commit

Permalink
Remove broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Apr 23, 2019
1 parent 9325451 commit e15bf96
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions src/libstd/collections/hash/map.rs
Expand Up @@ -3086,80 +3086,6 @@ mod test_map {
assert_eq!(format!("{:?}", empty), "{}");
}

#[test]
fn test_expand() {
let mut m = HashMap::new();

assert_eq!(m.len(), 0);
assert!(m.is_empty());

let mut i = 0;
let old_raw_cap = m.raw_capacity();
while old_raw_cap == m.raw_capacity() {
m.insert(i, i);
i += 1;
}

assert_eq!(m.len(), i);
assert!(!m.is_empty());
}

#[test]
fn test_behavior_resize_policy() {
let mut m = HashMap::new();

assert_eq!(m.len(), 0);
assert_eq!(m.raw_capacity(), 1);
assert!(m.is_empty());

m.insert(0, 0);
m.remove(&0);
assert!(m.is_empty());
let initial_raw_cap = m.raw_capacity();
m.reserve(initial_raw_cap);
let raw_cap = m.raw_capacity();

assert_eq!(raw_cap, initial_raw_cap * 2);

let mut i = 0;
for _ in 0..raw_cap * 3 / 4 {
m.insert(i, i);
i += 1;
}
// three quarters full

assert_eq!(m.len(), i);
assert_eq!(m.raw_capacity(), raw_cap);

for _ in 0..raw_cap / 4 {
m.insert(i, i);
i += 1;
}
// half full

let new_raw_cap = m.raw_capacity();
assert_eq!(new_raw_cap, raw_cap * 2);

for _ in 0..raw_cap / 2 - 1 {
i -= 1;
m.remove(&i);
assert_eq!(m.raw_capacity(), new_raw_cap);
}
// A little more than one quarter full.
m.shrink_to_fit();
assert_eq!(m.raw_capacity(), raw_cap);
// again, a little more than half full
for _ in 0..raw_cap / 2 {
i -= 1;
m.remove(&i);
}
m.shrink_to_fit();

assert_eq!(m.len(), i);
assert!(!m.is_empty());
assert_eq!(m.raw_capacity(), initial_raw_cap);
}

#[test]
fn test_reserve_shrink_to_fit() {
let mut m = HashMap::new();
Expand Down

0 comments on commit e15bf96

Please sign in to comment.