proper compilation of enums

This commit is contained in:
Alex Tkachman
2012-08-13 22:37:27 +03:00
parent e5820722ec
commit 5947759684
33 changed files with 839 additions and 134 deletions
+6
View File
@@ -0,0 +1,6 @@
enum class State {
O
K
}
fun box() = "${State.O.name()}${State.K.name()}"
@@ -0,0 +1,8 @@
enum class State {
_0
_1
_2
_3
}
fun box() = if(State._0.ordinal()==0 && State._1.ordinal() == 1 && State._2.ordinal() == 2 && State._3.ordinal() == 3) "OK" else "fail"
@@ -0,0 +1,6 @@
enum class State {
O
K
}
fun box() = "${State.O}${State.K}"
+11
View File
@@ -0,0 +1,11 @@
enum class Color {
RED
BLUE
}
fun box() = if(
Color.valueOf("RED") == Color.RED
&& Color.valueOf("BLUE") == Color.BLUE
&& Color.values()[0] == Color.RED
&& Color.values()[1] == Color.BLUE
) "OK" else "fail"