Add test for BTreeMap::clone_from
This commit is contained in:
parent
f547978392
commit
8651aa066f
1 changed files with 20 additions and 0 deletions
|
|
@ -554,6 +554,26 @@ fn test_clone() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clone_from() {
|
||||
let mut map1 = BTreeMap::new();
|
||||
let size = 30;
|
||||
|
||||
for i in 0..size {
|
||||
map1.insert(i, 10 * i);
|
||||
let mut map2 = BTreeMap::new();
|
||||
for j in 0..i {
|
||||
map2.insert(100 * j + 1, 2 * j + 1);
|
||||
let mut map1_copy = map2.clone();
|
||||
map1_copy.clone_from(&map1);
|
||||
assert_eq!(map1_copy, map1);
|
||||
let mut map2_copy = map1.clone();
|
||||
map2_copy.clone_from(&map2);
|
||||
assert_eq!(map2_copy, map2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(dead_code)]
|
||||
fn test_variance() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue