Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class UtBotSymbolicEngine(
trieNode = descr.tracer.add(coveredInstructions)

val earlierStateBeforeSize = coverageToMinStateBeforeSize[trieNode]
val curStateBeforeSize = stateBefore.calculateSize()
val curStateBeforeSize = concreteExecutionResult.stateBefore.calculateSize()

if (earlierStateBeforeSize == null || curStateBeforeSize < earlierStateBeforeSize)
coverageToMinStateBeforeSize[trieNode] = curStateBeforeSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ abstract class CgAbstractSpringTestClassConstructor(context: CgContext) :
fields += constructClassFields(testClassModel)
clearUnwantedVariableModels()

// constructClassFields may mark fields as initialized, while they are in
// fact not initialized, so we clearAlreadyInitializedFieldModels()
variableConstructor.clearAlreadyInitializedFieldModels()

constructAdditionalTestMethods()?.let { methodRegions += it }

for ((testSetIndex, testSet) in testClassModel.methodTestSets.withIndex()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class CgSpringVariableConstructor(context: CgContext) : CgVariableConstructor(co

private val fieldManagerFacade = ClassFieldManagerFacade(context)

fun clearAlreadyInitializedFieldModels() {
fieldManagerFacade.clearAlreadyInitializedModels()
}

override fun getOrCreateVariable(model: UtModel, name: String?): CgValue {
val variable = fieldManagerFacade.constructVariableForField(model)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class ClassFieldManagerFacade(context: CgContext) : CgContextOwner by context {

private val alreadyInitializedModels = mutableSetOf<UtModelWrapper>()

fun clearAlreadyInitializedModels() {
alreadyInitializedModels.clear()
}

fun constructVariableForField(model: UtModel): CgValue? {
relevantFieldManagers.forEach { manager ->
val alreadyCreatedVariable = manager.findCgValueByModel(model, manager.annotatedModels)
Expand Down