Add tests for misc operations

This commit is contained in:
Vitaliy.Bibaev
2017-12-21 15:37:04 +03:00
committed by Yan Zhulanow
parent 53209eaeec
commit d8bc73367f
25 changed files with 421 additions and 0 deletions
@@ -0,0 +1,35 @@
LineBreakpoint created at Chunked.kt:5
Run Java
Connected to the target VM
Chunked.kt:5
(0..5).asSequence()
.chunked(4)
.count()
chunked
before: 1,2,3,4,6,7
after: 5,8
count
before: 5,8
after: nothing
mappings for chunked
direct:
1 -> nothing
2 -> nothing
3 -> nothing
4 -> nothing
6 -> nothing
7 -> nothing
reverse:
nothing <- 5
nothing <- 8
mappings for count
direct:
5 -> nothing
8 -> nothing
reverse:
empty
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -0,0 +1,33 @@
LineBreakpoint created at ChunkedWithTransform.kt:5
Run Java
Connected to the target VM
ChunkedWithTransform.kt:5
sequenceOf(1, 2, 3, 4)
.chunked(2, { it.size })
.count()
chunked
before: 1,2,4,5
after: 3,6
count
before: 3,6
after: nothing
mappings for chunked
direct:
1 -> nothing
2 -> nothing
4 -> nothing
5 -> nothing
reverse:
nothing <- 3
nothing <- 6
mappings for count
direct:
3 -> nothing
6 -> nothing
reverse:
empty
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -0,0 +1,29 @@
LineBreakpoint created at ConstrainOnce.kt:5
Run Java
Connected to the target VM
ConstrainOnce.kt:5
(0..1).asSequence()
.constrainOnce()
.count()
constrainOnce
before: 1,3
after: 2,4
count
before: 2,4
after: nothing
mappings for constrainOnce
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,29 @@
LineBreakpoint created at OnEach.kt:5
Run Java
Connected to the target VM
OnEach.kt:5
(0..1).asSequence()
.onEach({})
.count()
onEach
before: 1,3
after: 2,4
count
before: 2,4
after: nothing
mappings for onEach
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,29 @@
LineBreakpoint created at RequireNoNulls.kt:5
Run Java
Connected to the target VM
RequireNoNulls.kt:5
(0..1).asSequence()
.requireNoNulls()
.count()
requireNoNulls
before: 1,3
after: 2,4
count
before: 2,4
after: nothing
mappings for requireNoNulls
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,10 @@
LineBreakpoint created at Windowed.kt:5
Run Java
Connected to the target VM
Windowed.kt:5
Exception caught: junit.framework.AssertionFailedError: Unresolved reference: it, Unresolved reference: it
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -0,0 +1,10 @@
LineBreakpoint created at WindowedWithPartial.kt:5
Run Java
Connected to the target VM
WindowedWithPartial.kt:5
Exception caught: junit.framework.AssertionFailedError: Expected: <null> but was: CHAIN_CONSTRUCTION, Expected: <null> but was: CHAIN_CONSTRUCTION
Disconnected from the target VM
WRONG!
Process finished with exit code 0
@@ -0,0 +1,29 @@
LineBreakpoint created at ZipWithGreater.kt:5
Run Java
Connected to the target VM
ZipWithGreater.kt:5
listOf(1, 2).asSequence()
.zip(sequenceOf(2, 1, 5), { old, new -> old + new })
.sum()
zip
before: 1,3
after: 2,4
sum
before: 2,4
after: nothing
mappings for zip
direct:
1 -> 2
3 -> 4
reverse:
1 <- 2
3 <- 4
mappings for sum
direct:
2 -> nothing
4 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,26 @@
LineBreakpoint created at ZipWithLesser.kt:5
Run Java
Connected to the target VM
ZipWithLesser.kt:5
sequenceOf(1, 2, 3)
.zip(sequenceOf(1))
.contains(5 to 1)
zip
before: 1
after: 2
contains
before: 2
after: nothing
mappings for zip
direct:
1 -> 2
reverse:
1 <- 2
mappings for contains
direct:
2 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,38 @@
LineBreakpoint created at ZipWithNextMany.kt:5
Run Java
Connected to the target VM
ZipWithNextMany.kt:5
sequenceOf(1, 2, 3, 2, 1)
.zipWithNext({ prev, next -> next + prev })
.count()
zipWithNext
before: 1,2,4,6,8
after: 3,5,7,9
count
before: 3,5,7,9
after: nothing
mappings for zipWithNext
direct:
1 -> nothing
2 -> nothing
4 -> nothing
6 -> nothing
8 -> nothing
reverse:
nothing <- 3
nothing <- 5
nothing <- 7
nothing <- 9
mappings for count
direct:
3 -> nothing
5 -> nothing
7 -> nothing
9 -> nothing
reverse:
empty
Disconnected from the target VM
WRONG
Process finished with exit code 0
@@ -0,0 +1,26 @@
LineBreakpoint created at ZipWithNextSingle.kt:5
Run Java
Connected to the target VM
ZipWithNextSingle.kt:5
sequenceOf(1)
.zipWithNext()
.count()
zipWithNext
before: 1
after: nothing
count
before: nothing
after: nothing
mappings for zipWithNext
direct:
1 -> nothing
reverse:
empty
mappings for count
direct:
empty
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,29 @@
LineBreakpoint created at ZipWithSame.kt:5
Run Java
Connected to the target VM
ZipWithSame.kt:5
sequenceOf(1, 2)
.zip(sequenceOf(3, 2))
.sumBy({ it.second })
zip
before: 1,3
after: 2,4
sumBy
before: 2,4
after: nothing
mappings for zip
direct:
1 -> 2
3 -> 4
reverse:
1 <- 2
3 <- 4
mappings for sumBy
direct:
2 -> nothing
4 -> nothing
reverse:
empty
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
(0..5).asSequence().chunked(4).count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
sequenceOf(1, 2, 3, 4).chunked(2) { it.size }.count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
(0..1).asSequence().constrainOnce().count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
(0..1).asSequence().onEach {}.count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
(0..1).asSequence().requireNoNulls().count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
intArrayOf(1, 1, 1, 1, 1, 1, 1).asSequence().windowed(3) { it.sum() }.count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
listOf(1, 1, 1, 1, 1).windowed(3, partialWindows = true) { it.size }.count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
listOf(1, 2).asSequence().zip(sequenceOf(2, 1, 5)) { old, new -> old + new }.sum()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
sequenceOf(1, 2, 3).zip(sequenceOf(1)).contains(5 to 1)
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
sequenceOf(1, 2, 3, 2, 1).zipWithNext { prev, next -> next + prev }.count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
sequenceOf(1).zipWithNext().count()
}
@@ -0,0 +1,6 @@
package misc
fun main(args: Array<String>) {
// Breakpoint!
sequenceOf(1, 2).zip(sequenceOf(3, 2)).sumBy { it.second }
}