2012-01-15 20:56:20 -06:00
|
|
|
// pp-exact
|
|
|
|
|
2012-01-19 20:31:08 -06:00
|
|
|
enum color { red = 1, green, blue, imaginary = -1, }
|
2012-01-15 20:56:20 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test_color(red, 1, "red");
|
|
|
|
test_color(green, 2, "green");
|
|
|
|
test_color(blue, 3, "blue");
|
|
|
|
test_color(imaginary, -1, "imaginary");
|
|
|
|
}
|
|
|
|
|
2012-01-16 22:04:02 -06:00
|
|
|
fn test_color(color: color, val: int, name: str) {
|
2012-01-15 20:56:20 -06:00
|
|
|
assert (color as int == val);
|
|
|
|
assert (color as float == val as float);
|
|
|
|
}
|
|
|
|
|