File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ enum color {
5
5
black = 0x000000 ,
6
6
white = 0xFFFFFF ,
7
7
imaginary = -1 ,
8
+ purple = 1 << 1 ,
9
+ orange = 8 >> 1
8
10
}
9
11
10
12
fn main ( ) {
@@ -14,6 +16,8 @@ fn main() {
14
16
test_color ( black, 0x000000 , "black" ) ;
15
17
test_color ( white, 0xFFFFFF , "white" ) ;
16
18
test_color ( imaginary, -1 , "imaginary" ) ;
19
+ test_color ( purple, 2 , "purple" ) ;
20
+ test_color ( orange, 4 , "orange" ) ;
17
21
}
18
22
19
23
fn test_color ( color : color , val : int , name : str ) unsafe {
@@ -32,6 +36,8 @@ fn get_color_alt(color: color) -> str {
32
36
black { "black"}
33
37
white { "white"}
34
38
imaginary { "imaginary"}
39
+ purple { "purple"}
40
+ orange { "orange"}
35
41
_ { "unknown"}
36
42
}
37
43
}
@@ -43,6 +49,8 @@ fn get_color_if(color: color) -> str {
43
49
else if color == black { "black" }
44
50
else if color == white { "white" }
45
51
else if color == imaginary { "imaginary" }
52
+ else if color == purple { "purple" }
53
+ else if color == orange { "orange" }
46
54
else { "unknown" }
47
55
}
48
56
You can’t perform that action at this time.
0 commit comments