]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | // run-pass |
2 | ||
0bf4aa26 | 3 | #![allow(non_camel_case_types)] |
223e47cc LB |
4 | |
5 | ||
c34b1796 | 6 | #[derive(Copy, Clone, Debug)] |
223e47cc LB |
7 | enum foo { large, small, } |
8 | ||
1a4d82fc | 9 | impl PartialEq for foo { |
223e47cc | 10 | fn eq(&self, other: &foo) -> bool { |
c34b1796 | 11 | ((*self) as usize) == ((*other) as usize) |
223e47cc LB |
12 | } |
13 | fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } | |
14 | } | |
15 | ||
16 | pub fn main() { | |
85aaf69f SL |
17 | let a = (1, 2, 3); |
18 | let b = (1, 2, 3); | |
970d7e83 | 19 | assert_eq!(a, b); |
223e47cc LB |
20 | assert!((a != (1, 2, 4))); |
21 | assert!((a < (1, 2, 4))); | |
22 | assert!((a <= (1, 2, 4))); | |
85aaf69f SL |
23 | assert!(((1, 2, 4) > a)); |
24 | assert!(((1, 2, 4) >= a)); | |
1a4d82fc JJ |
25 | let x = foo::large; |
26 | let y = foo::small; | |
223e47cc | 27 | assert!((x != y)); |
1a4d82fc JJ |
28 | assert_eq!(x, foo::large); |
29 | assert!((x != foo::small)); | |
223e47cc | 30 | } |