]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/evec-slice.rs
auto merge of #20154 : P1start/rust/qualified-assoc-type-generics, r=nikomatsakis
[rust.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 : &[int] = &[1,2,3,4,5];
15     let mut z : &[int] = &[1,2,3,4,5];
16     z = x;
17     assert_eq!(z[0], 1);
18     assert_eq!(z[4], 5);
19
20     let a : &[int] = &[1,1,1,1,1];
21     let b : &[int] = &[2,2,2,2,2];
22     let c : &[int] = &[2,2,2,2,3];
23     let cc : &[int] = &[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 }