2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2013-07-23 22:32:10 -05:00
|
|
|
enum Animal {
|
2014-06-27 14:30:25 -05:00
|
|
|
Cat = 0,
|
|
|
|
Dog = 1,
|
|
|
|
Horse = 2,
|
|
|
|
Snake = 3,
|
2013-07-23 22:32:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
enum Hero {
|
|
|
|
Batman = -1,
|
|
|
|
Superman = -2,
|
|
|
|
Ironman = -3,
|
|
|
|
Spiderman = -4
|
|
|
|
}
|
|
|
|
|
2013-09-25 02:43:37 -05:00
|
|
|
pub fn main() {
|
2014-11-06 02:05:53 -06:00
|
|
|
let pet: Animal = Animal::Snake;
|
|
|
|
let hero: Hero = Hero::Superman;
|
2015-06-07 13:00:38 -05:00
|
|
|
assert_eq!(pet as usize, 3);
|
|
|
|
assert_eq!(hero as isize, -2);
|
2013-07-23 22:32:10 -05:00
|
|
|
}
|