rust/tests/ui/array-slice-vec/evec-slice.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
878 B
Rust
Raw Normal View History

// run-pass
#![allow(unused_assignments)]
pub fn main() {
let x : &[isize] = &[1,2,3,4,5];
let mut z : &[isize] = &[1,2,3,4,5];
z = x;
assert_eq!(z[0], 1);
assert_eq!(z[4], 5);
2012-05-03 16:11:54 -05:00
let a : &[isize] = &[1,1,1,1,1];
let b : &[isize] = &[2,2,2,2,2];
let c : &[isize] = &[2,2,2,2,3];
let cc : &[isize] = &[2,2,2,2,2,2];
2012-05-03 16:11:54 -05:00
println!("{:?}", a);
2012-05-03 16:11:54 -05:00
2013-03-28 20:39:09 -05:00
assert!(a < b);
assert!(a <= b);
assert!(a != b);
assert!(b >= a);
assert!(b > a);
2012-05-03 16:11:54 -05:00
println!("{:?}", b);
2012-05-03 16:11:54 -05:00
2013-03-28 20:39:09 -05:00
assert!(b < c);
assert!(b <= c);
assert!(b != c);
assert!(c >= b);
assert!(c > b);
2012-05-03 16:11:54 -05:00
2013-03-28 20:39:09 -05:00
assert!(a < c);
assert!(a <= c);
assert!(a != c);
assert!(c >= a);
assert!(c > a);
2012-05-03 16:11:54 -05:00
println!("{:?}", c);
2012-05-03 16:11:54 -05:00
2013-03-28 20:39:09 -05:00
assert!(a < cc);
assert!(a <= cc);
assert!(a != cc);
assert!(cc >= a);
assert!(cc > a);
2012-05-03 16:11:54 -05:00
println!("{:?}", cc);
}