tests: Copy stdlib tests from Kotlin/JVM

This patch copies Kotlin/JVM stdlib tests (libraries/stdlib/test)
excepting ones with explicit java dependencies. It also transforms
the tests to use them as box-tests.
This commit is contained in:
Ilya Matveev
2017-04-04 18:20:09 +07:00
committed by ilmat192
parent 5d50943ebd
commit 85827b4880
530 changed files with 11027 additions and 4 deletions
@@ -0,0 +1,17 @@
import kotlin.test.*
fun box() {
for (component in listOf(Int.MIN_VALUE, -1, 0, KotlinVersion.MAX_COMPONENT_VALUE, KotlinVersion.MAX_COMPONENT_VALUE + 1, Int.MAX_VALUE)) {
for (place in 0..2) {
val (major, minor, patch) = IntArray(3) { index -> if (index == place) component else 0 }
if (component in 0..KotlinVersion.MAX_COMPONENT_VALUE) {
KotlinVersion(major, minor, patch)
} else {
assertFailsWith<IllegalArgumentException>("Expected $major.$minor.$patch to be invalid version") {
KotlinVersion(major, minor, patch)
}
}
}
}
}
@@ -0,0 +1,14 @@
import kotlin.test.*
fun box() {
assertTrue(KotlinVersion.CURRENT.isAtLeast(1, 1))
assertTrue(KotlinVersion.CURRENT.isAtLeast(1, 1, 0))
assertTrue(KotlinVersion.CURRENT >= KotlinVersion(1, 1))
assertTrue(KotlinVersion(1, 1) <= KotlinVersion.CURRENT)
val anotherCurrent = KotlinVersion.CURRENT.run { KotlinVersion(major, minor, patch) }
assertEquals(KotlinVersion.CURRENT, anotherCurrent)
assertEquals(KotlinVersion.CURRENT.hashCode(), anotherCurrent.hashCode())
assertEquals(0, KotlinVersion.CURRENT.compareTo(anotherCurrent))
}