rust/src/test/run-pass/enum-disr-val-pretty.rs
2012-02-03 20:54:18 -07:00

17 lines
354 B
Rust

// pp-exact
enum color { red = 1, green, blue, imaginary = -1, }
fn main() {
test_color(red, 1, "red");
test_color(green, 2, "green");
test_color(blue, 3, "blue");
test_color(imaginary, -1, "imaginary");
}
fn test_color(color: color, val: int, name: str) {
assert color as int == val;
assert color as float == val as float;
}