Support data parsing operations (#380)
This commit is contained in:
@@ -1034,6 +1034,19 @@ task string0(type: RunKonanTest) {
|
||||
source = "runtime/text/string0.kt"
|
||||
}
|
||||
|
||||
task parse0(type: RunKonanTest) {
|
||||
goldValue = "false\n" +
|
||||
"true\n" +
|
||||
"-1\n" +
|
||||
"-86\n" +
|
||||
"30\n" +
|
||||
"4294967295\n" +
|
||||
"bad format\n" +
|
||||
"0.5\n" +
|
||||
"2.39\n"
|
||||
source = "runtime/text/parse0.kt"
|
||||
}
|
||||
|
||||
task catch1(type: RunKonanTest) {
|
||||
goldValue = "Before\nCaught Throwable\nDone\n"
|
||||
source = "runtime/exceptions/catch1.kt"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
fun main(args: Array<String>) {
|
||||
println("false".toBoolean())
|
||||
println("true".toBoolean())
|
||||
println("-1".toByte())
|
||||
println("aa".toByte(16))
|
||||
println("11110".toInt(2))
|
||||
println("ffffffff".toLong(16))
|
||||
try {
|
||||
val x = "ffffffff".toLong(10)
|
||||
} catch (ne: NumberFormatException) {
|
||||
println("bad format")
|
||||
}
|
||||
println("0.5".toFloat())
|
||||
println("2.39".toDouble())
|
||||
}
|
||||
Reference in New Issue
Block a user