Groupped tests by folders

This commit is contained in:
Valentin Kipyatkov
2016-08-18 20:49:28 +03:00
parent d0f6e25783
commit 2d875e516e
392 changed files with 2400 additions and 2148 deletions
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * index++
if (x > 0) return x
}
return null
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
//TODO: should not be available without "asSequence()"!
// INTENTION_TEXT: "Replace with 'filterNot{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * index++
if (x * 100 > index * index) return x
}
return null
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
//TODO: should not be available without "asSequence()"!
// INTENTION_TEXT: "Replace with 'filterNot{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
return list
.filterNot { it.isBlank() }
.map { it.length * index++ }
.firstOrNull { it * 100 > index * index }
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
//TODO: should not be available without "asSequence()"!
// INTENTION_TEXT: "Replace with 'filterNot{}.map{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
return list
.asSequence()
.filterNot { it.isBlank() }
.map { it.length * index++ }
.firstOrNull { it * 100 > index * index }
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * index
val y = x * index++
if (y > 1000) return y
}
return null
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x * index }
.firstOrNull { it > 1000 }
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with '...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence()...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x * index }
.firstOrNull { it > 1000 }
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
val x = s.length * index
val y = x * index++
if (y > 1000) continue
return y
}
return null
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
return list
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x * index }
.firstOrNull { it <= 1000 }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
return list
.asSequence()
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x * index }
.firstOrNull { it <= 1000 }
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * index
index++
if (x > 0) return x
}
return null
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
// IS_APPLICABLE_2: false
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * index
index++
if ((x + index) % 3 == 0) return x
}
return null
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'flatMap{}.filterNot{}.mapIndexedTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.filterNot{}.mapIndexedTo(){}'"
fun foo(list: List<String>, target: MutableCollection<Int>) {
var i = 0
<caret>for (s in list) {
for (j in s.indices) {
if (j == 10) continue
target.add(i + j)
i++
}
}
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'flatMap{}.filterNot{}.mapIndexedTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.filterNot{}.mapIndexedTo(){}'"
fun foo(list: List<String>, target: MutableCollection<Int>) {
<caret>list
.flatMap { it.indices }
.filterNot { it == 10 }
.mapIndexedTo(target) { i, j -> i + j }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'flatMap{}.filterNot{}.mapIndexedTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.filterNot{}.mapIndexedTo(){}'"
fun foo(list: List<String>, target: MutableCollection<Int>) {
<caret>list
.asSequence()
.flatMap { it.indices.asSequence() }
.filterNot { it == 10 }
.mapIndexedTo(target) { i, j -> i + j }
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
if (s.isBlank()) continue
val x = s.length * ++index
if (x > 0) return x
}
return null
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * (index + 1) }
.firstOrNull { it > 0 }
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNot{}.mapIndexed{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.filterNot { it.isBlank() }
.mapIndexed { index, s -> s.length * (index + 1) }
.firstOrNull { it > 0 }
}