Add unit tests for new BTreeMap::into_{keys,values}
methods
This commit is contained in:
parent
41dd4ee7ff
commit
29d9233cf6
@ -1461,3 +1461,27 @@ fn test_into_iter_drop_leak_height_1() {
|
||||
assert_eq!(DROPS.load(Ordering::SeqCst), size);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_keys() {
|
||||
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
|
||||
let map: BTreeMap<_, _> = vec.into_iter().collect();
|
||||
let keys: Vec<_> = map.into_keys().collect();
|
||||
|
||||
assert_eq!(keys.len(), 3);
|
||||
assert!(keys.contains(&1));
|
||||
assert!(keys.contains(&2));
|
||||
assert!(keys.contains(&3));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_values() {
|
||||
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
|
||||
let map: BTreeMap<_, _> = vec.into_iter().collect();
|
||||
let values: Vec<_> = map.into_values().collect();
|
||||
|
||||
assert_eq!(values.len(), 3);
|
||||
assert!(values.contains(&'a'));
|
||||
assert!(values.contains(&'b'));
|
||||
assert!(values.contains(&'c'));
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#![feature(drain_filter)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(map_first_last)]
|
||||
#![feature(map_into_keys_values)]
|
||||
#![feature(new_uninit)]
|
||||
#![feature(pattern)]
|
||||
#![feature(str_split_once)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user