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