[K/N][tests] Added a bunch of tests on incremental compilation
This commit is contained in:
@@ -0,0 +1 @@
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1 @@
|
||||
fun bar() = 117
|
||||
@@ -0,0 +1,7 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(42, foo())
|
||||
assertEquals(117, bar())
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = assertEquals(42, foo())
|
||||
@@ -0,0 +1,6 @@
|
||||
package test1
|
||||
|
||||
interface I {
|
||||
fun baz(): String
|
||||
fun foo(): Int
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
interface I {
|
||||
fun foo(): Int
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test2
|
||||
|
||||
import test1.*
|
||||
|
||||
fun bar(x: I) = x.foo()
|
||||
@@ -0,0 +1,13 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class IImpl : I {
|
||||
override fun baz() = "zzz"
|
||||
override fun foo() = 42
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(42, bar(IImpl()))
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class IImpl : I {
|
||||
override fun foo() = 42
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(42, bar(IImpl()))
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test1
|
||||
|
||||
interface I {
|
||||
fun baz(): String
|
||||
fun foo(): Int
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
interface I {
|
||||
fun foo(): Int
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
interface J : I {
|
||||
fun bar(): String
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test2
|
||||
|
||||
import test1.*
|
||||
|
||||
fun bar(x: J) = x.bar()
|
||||
@@ -0,0 +1,14 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class JImpl : J {
|
||||
override fun baz() = "qxx"
|
||||
override fun foo() = 42
|
||||
override fun bar() = "zzz"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals("zzz", bar(JImpl()))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class JImpl : J {
|
||||
override fun foo() = 42
|
||||
override fun bar() = "zzz"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals("zzz", bar(JImpl()))
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test1
|
||||
|
||||
open class A {
|
||||
open fun baz() = "zzz"
|
||||
open fun foo() = 117
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
open class A {
|
||||
open fun foo() = 117
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test2
|
||||
|
||||
import test1.*
|
||||
|
||||
fun bar(a: A) = a.foo()
|
||||
@@ -0,0 +1,12 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class B : A() {
|
||||
override fun foo() = 42
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(42, bar(B()))
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test1
|
||||
|
||||
open class A {
|
||||
open fun baz() = "qxx"
|
||||
open fun foo() = 117
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
open class A {
|
||||
open fun foo() = 117
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test1
|
||||
|
||||
open class B : A() {
|
||||
open fun bar() = "zzz"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test2
|
||||
|
||||
import test1.*
|
||||
|
||||
fun bar(b: B) = b.bar()
|
||||
@@ -0,0 +1,12 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
class C : B() {
|
||||
override fun bar() = "qzz"
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals("qzz", bar(C()))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
inline fun foo(arr: IntArray, transform: (Int) -> Int): Int {
|
||||
var sum = 0
|
||||
for (x in arr) sum += transform(x)
|
||||
return sum
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
inline fun bar(arr: IntArray, transform: (Int) -> Int): Int {
|
||||
var max = Int.MIN_VALUE
|
||||
for (x in arr) {
|
||||
val y = transform(x)
|
||||
if (y > max) max = y
|
||||
}
|
||||
return max
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun checkFoo() {
|
||||
assertEquals(42, foo(intArrayOf(1, 2, 3, 4, 5, 6)) { it * 2 })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun checkBar() {
|
||||
assertEquals(42, bar(intArrayOf(1, 3, 7)) { it * 6 })
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package external
|
||||
|
||||
fun foo() = 42
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package external
|
||||
|
||||
fun foo2() = 128
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package external
|
||||
|
||||
fun foo2() = 117
|
||||
@@ -0,0 +1,6 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun doTest() {
|
||||
assertEquals(42, bar())
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun doTest2() {
|
||||
assertEquals(128, bar2())
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun doTest2() {
|
||||
assertEquals(117, bar2())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun bar() = external.foo()
|
||||
@@ -0,0 +1 @@
|
||||
fun bar2() = external.foo2()
|
||||
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
fun foo() = 20
|
||||
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
fun foo() = 21
|
||||
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
fun bar() = 117
|
||||
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
fun baz() = foo() * 2
|
||||
@@ -0,0 +1,8 @@
|
||||
import kotlin.test.*
|
||||
import test.*
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(117, bar())
|
||||
assertEquals(40, baz())
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import kotlin.test.*
|
||||
import test.*
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(117, bar())
|
||||
assertEquals(42, baz())
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package test1
|
||||
|
||||
fun foo() = 20
|
||||
@@ -0,0 +1,3 @@
|
||||
package test1
|
||||
|
||||
fun foo() = 21
|
||||
@@ -0,0 +1,3 @@
|
||||
package test2
|
||||
|
||||
fun bar() = 117
|
||||
@@ -0,0 +1,5 @@
|
||||
package test2
|
||||
|
||||
import test1.*
|
||||
|
||||
fun baz() = foo() * 2
|
||||
@@ -0,0 +1,9 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(117, bar())
|
||||
assertEquals(40, baz())
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import kotlin.test.*
|
||||
import test1.*
|
||||
import test2.*
|
||||
|
||||
@Test
|
||||
fun runTest() {
|
||||
assertEquals(117, bar())
|
||||
assertEquals(42, baz())
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package tezd
|
||||
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,5 @@
|
||||
import kotlin.test.*
|
||||
import tezd.*
|
||||
|
||||
@Test
|
||||
fun runTest() = assertEquals(42, foo())
|
||||
@@ -0,0 +1,5 @@
|
||||
import kotlin.test.*
|
||||
import test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = assertEquals(42, foo())
|
||||
@@ -0,0 +1 @@
|
||||
fun foo() = 41
|
||||
@@ -0,0 +1 @@
|
||||
fun foo() = 42
|
||||
@@ -0,0 +1,4 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = assertEquals(41, foo())
|
||||
@@ -0,0 +1,4 @@
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = assertEquals(42, foo())
|
||||
Reference in New Issue
Block a user