blob: b050b4d2b862befdfc4f61d47a435435b3cb7ff3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// 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;
}
|