]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/evec-slice.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / run-pass / evec-slice.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![allow(dead_assignment)]
12
13 pub fn main() {
14 let x : &[isize] = &[1,2,3,4,5];
15 let mut z : &[isize] = &[1,2,3,4,5];
16 z = x;
17 assert_eq!(z[0], 1);
18 assert_eq!(z[4], 5);
19
20 let a : &[isize] = &[1,1,1,1,1];
21 let b : &[isize] = &[2,2,2,2,2];
22 let c : &[isize] = &[2,2,2,2,3];
23 let cc : &[isize] = &[2,2,2,2,2,2];
24
25 println!("{:?}", a);
26
27 assert!(a < b);
28 assert!(a <= b);
29 assert!(a != b);
30 assert!(b >= a);
31 assert!(b > a);
32
33 println!("{:?}", b);
34
35 assert!(b < c);
36 assert!(b <= c);
37 assert!(b != c);
38 assert!(c >= b);
39 assert!(c > b);
40
41 assert!(a < c);
42 assert!(a <= c);
43 assert!(a != c);
44 assert!(c >= a);
45 assert!(c > a);
46
47 println!("{:?}", c);
48
49 assert!(a < cc);
50 assert!(a <= cc);
51 assert!(a != cc);
52 assert!(cc >= a);
53 assert!(cc > a);
54
55 println!("{:?}", cc);
56 }