2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_assignments)]
|
2018-08-30 07:18:55 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-03-25 19:06:52 -05:00
|
|
|
let x : &[isize] = &[1,2,3,4,5];
|
|
|
|
let mut z : &[isize] = &[1,2,3,4,5];
|
2012-04-19 18:37:06 -05:00
|
|
|
z = x;
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(z[0], 1);
|
|
|
|
assert_eq!(z[4], 5);
|
2012-05-03 16:11:54 -05:00
|
|
|
|
2015-03-25 19:06:52 -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
|
|
|
|
2015-01-07 16:58:31 -06: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
|
|
|
|
2015-01-07 16:58:31 -06: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
|
|
|
|
2015-01-07 16:58:31 -06: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
|
|
|
|
2015-01-07 16:58:31 -06:00
|
|
|
println!("{:?}", cc);
|
2012-04-19 18:37:06 -05:00
|
|
|
}
|