Skip to content

Commit 8d67c0f

Browse files
committed
Make CgContext much more thin
1 parent a90818b commit 8d67c0f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ internal interface CgContextOwner {
215215

216216
var statesCache: EnvironmentFieldStateCache
217217

218-
var allExecutions: List<UtExecution>
218+
/**
219+
* Result models required to create generic execution in parametrized tests.
220+
*/
221+
var successfulExecutionsModels: List<UtModel>
219222

220223
fun block(init: () -> Unit): Block {
221224
val prevBlock = currentBlock
@@ -463,7 +466,7 @@ internal data class CgContext(
463466
) : CgContextOwner {
464467
override lateinit var statesCache: EnvironmentFieldStateCache
465468
override lateinit var actual: CgVariable
466-
override lateinit var allExecutions: List<UtExecution>
469+
override lateinit var successfulExecutionsModels: List<UtModel>
467470

468471
/**
469472
* This property cannot be accessed outside of test class file scope

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,6 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
936936
}
937937

938938
private fun collectExecutionsResultFields() {
939-
val successfulExecutionsModels = allExecutions
940-
.filter {
941-
it.result is UtExecutionSuccess
942-
}.map {
943-
(it.result as UtExecutionSuccess).model
944-
}
945-
946939
for (model in successfulExecutionsModels) {
947940
when (model) {
948941
is UtCompositeModel -> {

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgTestClassConstructor.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.utbot.framework.codegen.model.constructor.TestClassModel
3232
import org.utbot.framework.codegen.model.tree.CgAuxiliaryClass
3333
import org.utbot.framework.codegen.model.tree.CgUtilEntity
3434
import org.utbot.framework.plugin.api.ClassId
35+
import org.utbot.framework.plugin.api.UtExecutionSuccess
3536
import org.utbot.framework.plugin.api.util.description
3637
import org.utbot.framework.plugin.api.util.humanReadableName
3738
import org.utbot.framework.plugin.api.util.kClass
@@ -124,7 +125,10 @@ internal class CgTestClassConstructor(val context: CgContext) :
124125
return null
125126
}
126127

127-
allExecutions = testSet.executions
128+
successfulExecutionsModels = testSet
129+
.executions
130+
.filter { it.result is UtExecutionSuccess }
131+
.map { (it.result as UtExecutionSuccess).model }
128132

129133
val (methodUnderTest, _, _, clustersInfo) = testSet
130134
val regions = mutableListOf<CgRegion<CgMethod>>()

0 commit comments

Comments
 (0)