Move some tests from boxWithStdlib/ to box/

Move those tests which do not require neither stdlib nor reflect
This commit is contained in:
Alexander Udalov
2016-03-05 18:39:20 +03:00
committed by Alexander Udalov
parent 54a615fcd3
commit 20e36438e2
217 changed files with 1561 additions and 1397 deletions
@@ -1,7 +0,0 @@
data class A(val x: Int) {
override fun hashCode(): Int = -3
}
fun box(): String {
return if (A(0).hashCode() == -3) "OK" else "fail"
}
@@ -1,6 +0,0 @@
data class A(val a: IntArray, var b: Array<String>)
fun box() : String {
if( A(intArrayOf(1,2,3),arrayOf("239")).hashCode() != 31*java.util.Arrays.hashCode(intArrayOf(0,1,2)) + "239".hashCode()) "fail"
return "OK"
}
@@ -1,5 +0,0 @@
data class A(val a: Boolean)
fun box() : String {
return if( A(true).hashCode()==1 && A(false).hashCode()==0 ) "OK" else "fail"
}
@@ -1,7 +0,0 @@
data class A(val a: Byte)
fun box() : String {
val v1 = A(10.toByte()).hashCode()
val v2 = (10.toByte() as Byte?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,7 +0,0 @@
data class A(val a: Char)
fun box() : String {
val v1 = A('a').hashCode()
val v2 = ('a' as Char?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,7 +0,0 @@
data class A(val a: Double)
fun box() : String {
val v1 = A(-10.toDouble()).hashCode()
val v2 = (-10.toDouble() as Double?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,7 +0,0 @@
data class A(val a: Float)
fun box() : String {
val v1 = A(-10.toFloat()).hashCode()
val v2 = (-10.toFloat() as Float?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,7 +0,0 @@
data class A<T>(val t: T)
fun box(): String {
val h = A<String?>(null).hashCode()
if (h != 0) return "Fail $h"
return "OK"
}
@@ -1,7 +0,0 @@
data class A(val a: Int)
fun box() : String {
val v1 = A(-10.toInt()).hashCode()
val v2 = (-10.toInt() as Int?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,7 +0,0 @@
data class A(val a: Long)
fun box() : String {
val v1 = A(-10.toLong()).hashCode()
val v2 = (-10.toLong() as Long?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}
@@ -1,16 +0,0 @@
data class A(val a: Any?, var x: Int)
data class B(val a: Any?)
data class C(val a: Int, var x: Int?)
data class D(val a: Int?)
fun box() : String {
if( A(null,19).hashCode() != 19) "fail"
if( A(239,19).hashCode() != (239*31+19)) "fail"
if( B(null).hashCode() != 0) "fail"
if( B(239).hashCode() != 239) "fail"
if( C(239,19).hashCode() != (239*31+19)) "fail"
if( C(239,null).hashCode() != 239*31) "fail"
if( D(239).hashCode() != (239)) "fail"
if( D(null).hashCode() != 0) "fail"
return "OK"
}
@@ -1,7 +0,0 @@
data class A(val a: Short)
fun box() : String {
val v1 = A(10.toShort()).hashCode()
val v2 = (10.toShort() as Short?)!!.hashCode()
return if( v1 == v2 ) "OK" else "$v1 $v2"
}