Add tests for distinct operations

This commit is contained in:
Vitaliy.Bibaev
2017-12-21 11:44:40 +03:00
committed by Yan Zhulanow
parent 113bb9ca46
commit d30a3b2495
7 changed files with 113 additions and 0 deletions
@@ -0,0 +1,39 @@
LineBreakpoint created at Distinct.kt:5
Run Java
Connected to the target VM
Distinct.kt:5
listOf(1, 2, 3, 2, 1, 3, 4, 2).asSequence()
.distinct()
.count()
distinct
before: 1,3,5,7,8,9,10,12
after: 2,4,6,11
count
before: 2,4,6,11
after: nothing
mappings for distinct
direct:
1 -> 2
3 -> 4
5 -> 6
7 -> 4
8 -> 2
9 -> 6
10 -> 11
12 -> 4
reverse:
1,8 <- 2
3,7,12 <- 4
5,9 <- 6
10 <- 11
mappings for count
direct:
2 -> nothing
4 -> nothing
6 -> nothing
11 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,10 @@
LineBreakpoint created at DistinctBy.kt:5
Run Java
Connected to the target VM
DistinctBy.kt:5
Exception caught: junit.framework.AssertionFailedError: Unresolved reference: andThen, Unresolved reference: andThen
Disconnected from the target VM
WRONG! Should be fixed in the platform
Process finished with exit code 0
@@ -0,0 +1,34 @@
LineBreakpoint created at DistinctObjects.kt:6
Run Java
Connected to the target VM
DistinctObjects.kt:6
listOf(str('a'), str('b'), str('a'), str('c'), str('b')).asSequence()
.distinct()
.count()
distinct
before: 1,3,5,6,8
after: 2,4,7
count
before: 2,4,7
after: nothing
mappings for distinct
direct:
1 -> 2
3 -> 4
5 -> 2
6 -> 7
8 -> 4
reverse:
1,5 <- 2
3,8 <- 4
6 <- 7
mappings for count
direct:
2 -> nothing
4 -> nothing
7 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,6 @@
package distinct
fun main(args: Array<String>) {
// Breakpoint!
listOf(1, 2, 3, 2, 1, 3, 4, 2).asSequence().distinct().count()
}
@@ -0,0 +1,6 @@
package distinct
fun main(args: Array<String>) {
// Breakpoint!
listOf(3, 4, 234, 34, 54, 23, 4, 23, 543, 5, 46).asSequence().distinctBy { it % 10 }.toList()
}
@@ -0,0 +1,7 @@
package distinct
fun main(args: Array<String>) {
fun str(chr: Char): String = String(charArrayOf(chr))
// Breakpoint!
listOf(str('a'), str('b'), str('a'), str('c'), str('b')).asSequence().distinct().count()
}