Use Char.MIN_VALUE and MAX_VALUE in tests

This commit is contained in:
Ilya Gorbunov
2018-06-22 21:39:22 +03:00
parent 92e149fa40
commit 5f3a7f0147
8 changed files with 21 additions and 9 deletions
+5 -4
View File
@@ -1,10 +1,11 @@
fun box(): String {
val c1: Char = 0.toChar()
val c1: Char = Char.MIN_VALUE
val c2 = c1 - 1
if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive."
if (c2 < c1) return "fail: Char.MIN_VALUE - 1 should overflow to positive."
val c3 = c2 + 1
if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero."
val c3: Char = Char.MAX_VALUE
val c4 = c3 + 1
if (c4 > c3) return "fail: Char.MAX_VALUE + 1 should overflow to zero."
return "OK"
}