Add simplest execution tests for support of kotlin collection
This commit is contained in:
committed by
Yan Zhulanow
parent
4552504315
commit
b916fc6ca2
@@ -0,0 +1,6 @@
|
|||||||
|
package checks
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).all { it % 2 == 0 }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package checks
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).all { it < 10 }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package distinct
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3, 4, 3, 2, 1).distinct()
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package distinct
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3, 4, 5).distinctBy { it % 2 }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package filter
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).filter { it % 2 == 0 }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package final
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3, 4).average()
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package flatMap
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(2, 3).flatMap { 0..it }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package grouping
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3, 4, 5).groupBy { it % 2 }
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package map
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).map { it * it }
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package map
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val dst = mutableListOf(1, 2, 3)
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(4, 5, 6).mapTo(dst, { it * it }).filter { it % 4 != 0 }.mapTo(dst, { it * it })
|
||||||
|
println(dst)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package misc
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).indexOf(2)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package zip
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2).zip(listOf(1, 4, 8))
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package zip
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3).zip(listOf(1, 4))
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package zip
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
// Breakpoint!
|
||||||
|
listOf(1, 2, 3).zip(listOf(1, 4, 8))
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class ChecksTest : CollectionTestCase("checks") {
|
||||||
|
fun testAllMatchFalse() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testAllMatchTrue() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
import com.intellij.debugger.streams.kotlin.exec.KotlinTraceEvaluationTestCase
|
||||||
|
import com.intellij.debugger.streams.kotlin.lib.KotlinCollectionSupportProvider
|
||||||
|
import com.intellij.debugger.streams.lib.LibrarySupportProvider
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
abstract class CollectionTestCase(private val packageName: String) : KotlinTraceEvaluationTestCase() {
|
||||||
|
override val appName: String = "collection"
|
||||||
|
override val librarySupport: LibrarySupportProvider = KotlinCollectionSupportProvider()
|
||||||
|
|
||||||
|
override fun createLocalProcess(className: String) = super.createLocalProcess("$packageName.$className")
|
||||||
|
|
||||||
|
protected fun doTestWithResult() = doTest(false)
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class DistinctOperationsTest : CollectionTestCase("distinct") {
|
||||||
|
fun testDistinct() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testDistinctBy() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class FilterOperationsTest : CollectionTestCase("filter") {
|
||||||
|
fun testFilter() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class FinalOperationsTest : CollectionTestCase("final") {
|
||||||
|
fun testAverage() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class FlatMapOperationsTest : CollectionTestCase("flatMap") {
|
||||||
|
fun testFlatMap() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class GroupingOperationsTest : CollectionTestCase("grouping") {
|
||||||
|
fun testGroupBy() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class MapOperationsTest : CollectionTestCase("map") {
|
||||||
|
fun testMap() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testMapToSameCollection() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class MiscOperationsTest : CollectionTestCase("misc") {
|
||||||
|
fun testIndexOf() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.intellij.debugger.streams.kotlin.exec.collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Vitaliy.Bibaev
|
||||||
|
*/
|
||||||
|
class ZipOperationsTest : CollectionTestCase("zip") {
|
||||||
|
fun testZipWithSame() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testZipWithGreater() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testZipWithLesser() {
|
||||||
|
doTestWithResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user