Merge boxWithStdlib testData into box, delete BoxWithStdlib test
This commit is contained in:
committed by
Alexander Udalov
parent
22bfc9786a
commit
06a67e6602
@@ -0,0 +1,22 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline fun<reified T1, reified T2> createArray(n: Int, crossinline block: () -> Pair<T1, T2>): Pair<Array<T1>, Array<T2>> {
|
||||
return Pair(Array(n) { block().first }, Array(n) { block().second })
|
||||
}
|
||||
|
||||
inline fun<T1, T2, T3, T4, T5, T6, reified R> recursive(
|
||||
crossinline block: () -> R
|
||||
): Pair<Array<R>, Array<R>> {
|
||||
return createArray(5) { Pair(block(), block()) }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val y = createArray(5) { Pair(1, "test") }
|
||||
val x = recursive<Int, Int, Int, Int, Int, Int, String>(){ "abc" }
|
||||
|
||||
assert(y.first.all { it == 1 } )
|
||||
assert(y.second.all { it == "test" })
|
||||
assert(x.first.all { it == "abc" })
|
||||
assert(x.second.all { it == "abc" })
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user