@@ -5,6 +5,7 @@ import org.utbot.framework.plugin.api.ExecutableId
5
5
import org.utbot.framework.plugin.api.FieldId
6
6
import org.utbot.framework.plugin.api.UtClusterInfo
7
7
import org.utbot.framework.plugin.api.UtExecution
8
+ import org.utbot.framework.plugin.api.UtExecutionFailure
8
9
import org.utbot.framework.plugin.api.UtExecutionSuccess
9
10
import org.utbot.framework.plugin.api.UtMethodTestSet
10
11
import org.utbot.framework.plugin.api.util.executableId
@@ -36,12 +37,18 @@ data class CgMethodTestSet private constructor(
36
37
*/
37
38
fun splitExecutionsByResult () : List <CgMethodTestSet > {
38
39
val successfulExecutions = executions.filter { it.result is UtExecutionSuccess }
39
- val executionsByResult: Map <ClassId , List <UtExecution >> =
40
- if (successfulExecutions.isNotEmpty()) {
41
- successfulExecutions.groupBy { (it.result as UtExecutionSuccess ).model.classId }
42
- } else {
43
- mapOf (objectClassId to executions)
44
- }
40
+ val failureExecutions = executions.filter { it.result is UtExecutionFailure }
41
+
42
+ val executionsByResult: MutableMap <ClassId , List <UtExecution >> =
43
+ successfulExecutions
44
+ .groupBy { (it.result as UtExecutionSuccess ).model.classId }.toMutableMap()
45
+
46
+ // if we have failure executions, we add them to the first successful executions group (which is grouped by result type)
47
+ // instead of skipping them
48
+ val firstPairKey = executionsByResult.keys.firstOrNull()
49
+ if (firstPairKey != null ) {
50
+ executionsByResult[firstPairKey] = executionsByResult[firstPairKey]!! + failureExecutions
51
+ }
45
52
46
53
return executionsByResult.map{ (_, executions) -> substituteExecutions(executions) }
47
54
}
@@ -52,15 +59,8 @@ data class CgMethodTestSet private constructor(
52
59
* A separate test set is created for each combination of modified statics.
53
60
*/
54
61
fun splitExecutionsByChangedStatics (): List <CgMethodTestSet > {
55
- val successfulExecutions = executions.filter { it.result is UtExecutionSuccess }
56
62
val executionsByStaticsUsage: Map <Set <FieldId >, List <UtExecution >> =
57
- if (successfulExecutions.isNotEmpty()) {
58
- successfulExecutions.groupBy {
59
- it.stateBefore.statics.keys
60
- }
61
- } else {
62
- mapOf (executions.first().stateBefore.statics.keys to executions)
63
- }
63
+ executions.groupBy { it.stateBefore.statics.keys }
64
64
65
65
return executionsByStaticsUsage.map { (_, executions) -> substituteExecutions(executions) }
66
66
}
0 commit comments