Skip to content

Commit fccc354

Browse files
committed
Used coverage calculation instead of matchers for flaky executions number in some List tests
1 parent 207f353 commit fccc354

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

utbot-framework-test/src/test/kotlin/org/utbot/examples/collections/ListsPart3Test.kt

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import org.junit.jupiter.api.Disabled
55
import org.junit.jupiter.api.Test
66
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
77
import org.utbot.tests.infrastructure.DoNotCalculate
8-
import org.utbot.tests.infrastructure.between
98
import org.utbot.tests.infrastructure.isException
109
import org.utbot.testcheckers.eq
1110
import org.utbot.testcheckers.ge
1211
import org.utbot.tests.infrastructure.CodeGeneration
12+
import org.utbot.tests.infrastructure.FullWithAssumptions
13+
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
1314

1415
// TODO failed Kotlin compilation SAT-1332
1516
internal class ListsPart3Test : UtValueTestCaseChecker(
@@ -27,8 +28,7 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
2728
eq(3),
2829
{ a, _ -> a == null },
2930
{ a, r -> a != null && a.isEmpty() && r!!.isEmpty() },
30-
{ a, r -> a != null && a.isNotEmpty() && r != null && r.isNotEmpty() && a.toList() == r.also { println(r) } },
31-
coverage = DoNotCalculate
31+
{ a, r -> a != null && a.isNotEmpty() && !r.isNullOrEmpty() && a.toList() == r.also { println(r) } },
3232
)
3333
}
3434

@@ -38,19 +38,18 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
3838
Lists::bigListFromParameters,
3939
eq(1),
4040
{ list, r -> list.size == r && list.size == 11 },
41-
coverage = DoNotCalculate
41+
coverage = FullWithAssumptions(assumeCallsNumber = 1)
4242
)
4343
}
4444

4545
@Test
4646
fun testGetNonEmptyCollection() {
4747
check(
4848
Lists::getNonEmptyCollection,
49-
eq(3),
49+
ignoreExecutionsNumber,
5050
{ collection, _ -> collection == null },
5151
{ collection, r -> collection.isEmpty() && r == null },
5252
{ collection, r -> collection.isNotEmpty() && collection == r },
53-
coverage = DoNotCalculate
5453
)
5554
}
5655

@@ -63,7 +62,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
6362
{ l, _ -> l.isEmpty() },
6463
{ l, r -> l[0] == null && r == null },
6564
{ l, r -> l[0] != null && r is Array<*> && r.isArrayOf<Int>() && r.size == 1 && r[0] == l[0] },
66-
coverage = DoNotCalculate
6765
)
6866
}
6967

@@ -84,15 +82,14 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
8482

8583
sizeConstraint && content
8684
},
87-
coverage = DoNotCalculate
8885
)
8986
}
9087

9188
@Test
9289
fun removeElementsTest() {
9390
checkWithException(
9491
Lists::removeElements,
95-
between(7..8),
92+
ignoreExecutionsNumber,
9693
{ list, _, _, r -> list == null && r.isException<NullPointerException>() },
9794
{ list, i, _, r -> list != null && i < 0 && r.isException<IndexOutOfBoundsException>() },
9895
{ list, i, _, r -> list != null && i >= 0 && list.size > i && list[i] == null && r.isException<NullPointerException>() },
@@ -134,7 +131,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
134131

135132
precondition && postcondition
136133
},
137-
coverage = DoNotCalculate
138134
)
139135
}
140136

@@ -145,7 +141,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
145141
eq(2),
146142
{ x, r -> x % 2 != 0 && r is java.util.LinkedList && r == List(4) { it } },
147143
{ x, r -> x % 2 == 0 && r is java.util.ArrayList && r == List(4) { it } },
148-
coverage = DoNotCalculate
149144
)
150145
}
151146

@@ -158,7 +153,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
158153
{ x, r -> x != null && x.isEmpty() && r!!.isEmpty() },
159154
{ x, _ -> x != null && x.isNotEmpty() && x.any { it == null } },
160155
{ x, r -> x != null && x.isNotEmpty() && x.all { it is Int } && r!!.toList() == x },
161-
coverage = DoNotCalculate
162156
)
163157
}
164158

@@ -170,7 +164,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
170164
{ x, _ -> x == null },
171165
{ x, r -> x != null && x.isEmpty() && r!!.isEmpty() },
172166
{ x, r -> x != null && x.isNotEmpty() && r!!.containsAll(x.toList()) && r.size == x.size },
173-
coverage = DoNotCalculate
174167
)
175168
}
176169

@@ -182,7 +175,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
182175
{ list, _ -> list == null },
183176
{ list, r -> list.size >= 2 && r == emptyList<Int>() },
184177
{ list, r -> list.size < 2 && r == emptyList<Int>() },
185-
coverage = DoNotCalculate
186178
)
187179
}
188180

@@ -198,7 +190,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
198190
{ list, i, r ->
199191
list != null && list.isNotEmpty() && r != null && r.size == 1 + list.size && r == listOf(i) + list
200192
},
201-
coverage = DoNotCalculate
202193
)
203194
}
204195

@@ -213,7 +204,6 @@ internal class ListsPart3Test : UtValueTestCaseChecker(
213204
{ list, i, r ->
214205
list != null && i in 0..list.lastIndex && r == list.toMutableList().apply { addAll(i, listOf(0, 1)) }
215206
},
216-
coverage = DoNotCalculate
217207
)
218208
}
219209

0 commit comments

Comments
 (0)