Files
kotlin-fork/js/js.translator/testData/number/cases/byteAndShortConversions.kt
T
2014-03-11 20:04:00 +04:00

41 lines
810 B
Kotlin

package foo
fun testShortConversions(c: Short): Boolean {
if (c.toDouble() != 3.0) {
return false
}
if (c.toFloat() != 3.toFloat()) {
return false
}
if (c.toByte() != 3.toByte()) {
return false
}
if (c.toInt() != 3) {
return false
}
if (c.toShort() != 3.toShort()) {
return false
}
return true
}
fun testByteConversions(c: Byte): Boolean {
if (c.toDouble() != 3.0) {
return false
}
if (c.toFloat() != 3.toFloat()) {
return false
}
if (c.toByte() != 3.toByte()) {
return false
}
if (c.toInt() != 3) {
return false
}
if (c.toShort() != 3.toShort()) {
return false
}
return true
}
fun box() = testShortConversions(3) && testByteConversions(3)