Support data parsing operations (#380)

This commit is contained in:
Nikolay Igotti
2017-03-23 12:54:24 +03:00
committed by GitHub
parent 8afa12684e
commit b5c60e3082
13 changed files with 534 additions and 5 deletions
+13
View File
@@ -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())
}