Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/binaryOp/overflowInt.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

11 lines
301 B
Kotlin

fun box(): String {
val i1: Int = Int.MAX_VALUE
val i2 = i1 + 1
if (i2 > i1) return "fail: Int.MAX_VALUE + 1 should overflow to negative."
val i3: Int = Int.MIN_VALUE
val i4 = i3 - 1
if (i4 < i3) return "fail: Int.MIN_VALUE - 1 should overflow to positive."
return "OK"
}