Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/binaryOp/overflowChar.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

10 lines
260 B
Kotlin

fun box(): String {
val c1: Char = 0.toChar()
val c2 = c1 - 1
if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive."
val c3 = c2 + 1
if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero."
return "OK"
}