@@ -5,6 +5,7 @@ import org.utbot.framework.plugin.api.ExecutableId
55import org.utbot.framework.plugin.api.FieldId
66import org.utbot.framework.plugin.api.UtClusterInfo
77import org.utbot.framework.plugin.api.UtExecution
8+ import org.utbot.framework.plugin.api.UtExecutionFailure
89import org.utbot.framework.plugin.api.UtExecutionSuccess
910import org.utbot.framework.plugin.api.UtMethodTestSet
1011import org.utbot.framework.plugin.api.util.executableId
@@ -36,12 +37,18 @@ data class CgMethodTestSet private constructor(
3637 */
3738 fun splitExecutionsByResult () : List <CgMethodTestSet > {
3839 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+ }
4552
4653 return executionsByResult.map{ (_, executions) -> substituteExecutions(executions) }
4754 }
@@ -52,15 +59,8 @@ data class CgMethodTestSet private constructor(
5259 * A separate test set is created for each combination of modified statics.
5360 */
5461 fun splitExecutionsByChangedStatics (): List <CgMethodTestSet > {
55- val successfulExecutions = executions.filter { it.result is UtExecutionSuccess }
5662 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 }
6464
6565 return executionsByStaticsUsage.map { (_, executions) -> substituteExecutions(executions) }
6666 }
0 commit comments