Add tests for VecDeque clone_from

This commit is contained in:
Charles Gleason 2019-10-03 15:04:35 -04:00
parent 91cf02cfa7
commit 10671f10c3

View file

@ -361,6 +361,29 @@ fn test_vec_from_vecdeque() {
}
}
#[test]
fn test_clone_from() {
let m = vec![1; 8];
let n = vec![2; 12];
for pfv in 0..8 {
for pfu in 0..8 {
for longer in 0..2 {
let (vr, ur) = if longer == 0 { (&m, &n) } else { (&n, &m) };
let mut v = VecDeque::from(vr.clone());
for _ in 0..pfv {
v.push_front(1);
}
let mut u = VecDeque::from(ur.clone());
for _ in 0..pfu {
u.push_front(2);
}
v.clone_from(&u);
assert_eq!(&v, &u);
}
}
}
}
#[test]
fn issue_53529() {
use crate::boxed::Box;