Add a compiler box test for Boolean.hashCode()
This commit is contained in:
committed by
Space Team
parent
193aa0f935
commit
36924775c8
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user