diff options
| author | Ayush Kumar Mishra <ayush.k.mishra@xcelenergy.com> | 2020-09-04 17:18:26 +0530 |
|---|---|---|
| committer | Ayush Kumar Mishra <ayush.k.mishra@xcelenergy.com> | 2020-09-04 17:18:26 +0530 |
| commit | d16bbd1cb0673713fe9a524c092f7d0ff93c81a6 (patch) | |
| tree | bd6200b87a800e920c60db8156d4146659b5a08a /library/alloc/tests | |
| parent | 4ffb5c5954a304daf47a567b34e74e421db86d98 (diff) | |
| download | rust-d16bbd1cb0673713fe9a524c092f7d0ff93c81a6.tar.gz rust-d16bbd1cb0673713fe9a524c092f7d0ff93c81a6.zip | |
Move Vec slice UI tests in library
Diffstat (limited to 'library/alloc/tests')
| -rw-r--r-- | library/alloc/tests/vec.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index 8e66c8a22ce..df86a775e5a 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -346,6 +346,29 @@ fn test_zip_unzip() { } #[test] +fn test_cmp() { + let x: &[isize] = &[1, 2, 3, 4, 5]; + let cmp: &[isize] = &[1, 2, 3, 4, 5]; + assert_eq!(&x[..], cmp); + let cmp: &[isize] = &[3, 4, 5]; + assert_eq!(&x[2..], cmp); + let cmp: &[isize] = &[1, 2, 3]; + assert_eq!(&x[..3], cmp); + let cmp: &[isize] = &[2, 3, 4]; + assert_eq!(&x[1..4], cmp); + + let x: Vec<isize> = vec![1, 2, 3, 4, 5]; + let cmp: &[isize] = &[1, 2, 3, 4, 5]; + assert_eq!(&x[..], cmp); + let cmp: &[isize] = &[3, 4, 5]; + assert_eq!(&x[2..], cmp); + let cmp: &[isize] = &[1, 2, 3]; + assert_eq!(&x[..3], cmp); + let cmp: &[isize] = &[2, 3, 4]; + assert_eq!(&x[1..4], cmp); +} + +#[test] fn test_vec_truncate_drop() { static mut DROPS: u32 = 0; struct Elem(i32); |
