Add a compiler box test for Boolean.hashCode()

This commit is contained in:
Abduqodiri Qurbonzoda
2023-06-12 00:13:54 +03:00
committed by Space Team
parent 193aa0f935
commit 36924775c8
16 changed files with 114 additions and 0 deletions
@@ -0,0 +1,26 @@
// WITH_STDLIB
import kotlin.test.*
fun box() : String {
assertEquals(1231, true.hashCode())
assertEquals(1231, hashCode(true))
assertEquals(1237, false.hashCode())
assertEquals(1237, hashCode(false))
var b: Boolean? = null
assertEquals(0, b.hashCode())
assertEquals(0, hashCode(b))
b = true
assertEquals(1231, b.hashCode())
assertEquals(1231, hashCode(b))
b = false
assertEquals(1237, b.hashCode())
assertEquals(1237, hashCode(b))
return "OK"
}
fun hashCode(b: Boolean?): Int {
return b.hashCode()
}