Add tests on filtering operations

This commit is contained in:
Vitaliy.Bibaev
2017-12-21 00:51:02 +03:00
committed by Yan Zhulanow
parent 22c455a01e
commit 5383ec50d2
21 changed files with 362 additions and 0 deletions
@@ -0,0 +1,28 @@
LineBreakpoint created at Drop.kt:5
Run Java
Connected to the target VM
Drop.kt:5
listOf(1, 2, 3).asSequence()
.drop(2)
.count()
drop
before: 1,2,3
after: 4
count
before: 4
after: nothing
mappings for drop
direct:
1 -> nothing
2 -> nothing
3 -> 4
reverse:
3 <- 4
mappings for count
direct:
4 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,30 @@
LineBreakpoint created at DropWhile.kt:5
Run Java
Connected to the target VM
DropWhile.kt:5
listOf("abs", "bcs", "abt").asSequence()
.dropWhile({ it.startsWith('a') })
.forEach({})
dropWhile
before: 1,2,4
after: 3,5
forEach
before: 3,5
after: nothing
mappings for dropWhile
direct:
1 -> nothing
2 -> 3
4 -> 5
reverse:
2 <- 3
4 <- 5
mappings for forEach
direct:
3 -> nothing
5 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,28 @@
LineBreakpoint created at Filter.kt:5
Run Java
Connected to the target VM
Filter.kt:5
listOf(1,2,3).asSequence()
.filter({ it == 2 })
.count()
filter
before: 1,2,4
after: 3
count
before: 3
after: nothing
mappings for filter
direct:
1 -> nothing
2 -> 3
4 -> nothing
reverse:
2 <- 3
mappings for count
direct:
3 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,30 @@
LineBreakpoint created at FilterIndexed.kt:5
Run Java
Connected to the target VM
FilterIndexed.kt:5
intArrayOf(1, 2, 3).asSequence()
.filterIndexed({ index, _ -> index % 2 == 0 })
.count()
filterIndexed
before: 1,3,4
after: 2,5
count
before: 2,5
after: nothing
mappings for filterIndexed
direct:
1 -> 2
3 -> nothing
4 -> 5
reverse:
1 <- 2
4 <- 5
mappings for count
direct:
2 -> nothing
5 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,14 @@
LineBreakpoint created at FilterIsInstance.kt:6
Run Java
Connected to the target VM
FilterIsInstance.kt:6
Exception caught: junit.framework.AssertionFailedError: Type inference failed: Not enough information to infer parameter R in inline fun <reified R> Sequence<*>.filterIsInstance(): Sequence<R>
Please specify it explicitly.
, Type inference failed: Not enough information to infer parameter R in inline fun <reified R> Sequence<*>.filterIsInstance(): Sequence<R>
Please specify it explicitly.
WRONG! Should be fixed in the platform
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,30 @@
LineBreakpoint created at FilterNot.kt:6
Run Java
Connected to the target VM
FilterNot.kt:6
booleanArrayOf(true, false, false).asSequence()
.filterNot({ it })
.lastIndexOf(true)
filterNot
before: 1,2,4
after: 3,5
lastIndexOf
before: 3,5
after: nothing
mappings for filterNot
direct:
1 -> nothing
2 -> 3
4 -> 5
reverse:
2 <- 3
4 <- 5
mappings for lastIndexOf
direct:
3 -> nothing
5 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,31 @@
LineBreakpoint created at Minus.kt:6
Run Java
Connected to the target VM
Minus.kt:6
byteArrayOf(1, 2, 3, 2).asSequence()
.minus(arrayOf(2.toByte()))
.count()
minus
before: 1,3,4,6
after: 2,5
count
before: 2,5
after: nothing
mappings for minus
direct:
1 -> 2
3 -> nothing
4 -> 5
6 -> nothing
reverse:
1 <- 2
4 <- 5
mappings for count
direct:
2 -> nothing
5 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,33 @@
LineBreakpoint created at MinusElement.kt:5
Run Java
Connected to the target VM
MinusElement.kt:5
byteArrayOf(1, 2, 3, 2).asSequence()
.minusElement(2.toByte())
.count()
minusElement
before: 1,3,4,6
after: 2,5,7
count
before: 2,5,7
after: nothing
mappings for minusElement
direct:
1 -> 2
3 -> nothing
4 -> 5
6 -> 7
reverse:
1 <- 2
4 <- 5
6 <- 7
mappings for count
direct:
2 -> nothing
5 -> nothing
7 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,29 @@
LineBreakpoint created at Take.kt:5
Run Java
Connected to the target VM
Take.kt:5
charArrayOf('a', 'b', 'c').asSequence()
.take(2)
.count()
take
before: 1,3
after: 2,4
count
before: 2,4
after: nothing
mappings for take
direct:
1 -> 2
3 -> 4
reverse:
1 <- 2
3 <- 4
mappings for count
direct:
2 -> nothing
4 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,27 @@
LineBreakpoint created at TakeWhile.kt:6
Run Java
Connected to the target VM
TakeWhile.kt:6
doubleArrayOf(1.0, 3.0, 5.0).asSequence()
.takeWhile({ it < 2 })
.forEach({})
takeWhile
before: 1,3
after: 2
forEach
before: 2
after: nothing
mappings for takeWhile
direct:
1 -> 2
3 -> nothing
reverse:
1 <- 2
mappings for forEach
direct:
2 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
listOf(1, 2, 3).asSequence().drop(2).count()
}
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
listOf("abs", "bcs", "abt").asSequence().dropWhile { it.startsWith('a') }.forEach {}
}
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
listOf(1,2,3).asSequence().filter { it == 2 }.count()
}
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
intArrayOf(1, 2, 3).asSequence().filterIndexed({ index, _ -> index % 2 == 0 }).count()
}
@@ -0,0 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package filter
fun main(args: Array<String>) {
// Breakpoint!
arrayOf(true, "12", false).asSequence().filterIsInstance<Boolean>().forEach {}
}
@@ -0,0 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package filter
fun main(args: Array<String>) {
// Breakpoint!
booleanArrayOf(true, false, false).asSequence().filterNot { it }.lastIndexOf(true)
}
@@ -0,0 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package filter
fun main(args: Array<String>) {
// Breakpoint!
byteArrayOf(1, 2, 3, 2).asSequence().minus(arrayOf(2.toByte())).count()
}
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
byteArrayOf(1, 2, 3, 2).asSequence().minusElement(2.toByte()).count()
}
@@ -0,0 +1,6 @@
package filter
fun main(args: Array<String>) {
// Breakpoint!
charArrayOf('a', 'b', 'c').asSequence().take(2).count()
}
@@ -0,0 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package filter
fun main(args: Array<String>) {
// Breakpoint!
doubleArrayOf(1.0, 3.0, 5.0).asSequence().takeWhile { it < 2 }.forEach {}
}