Skip to content

Commit f77a0f3

Browse files
committed
Cleanup CgMethodTestSet class
1 parent 95623c0 commit f77a0f3

File tree

4 files changed

+13
-37
lines changed

4 files changed

+13
-37
lines changed

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

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package org.utbot.framework.codegen.model.constructor
22

33
import org.utbot.framework.plugin.api.ClassId
44
import org.utbot.framework.plugin.api.ExecutableId
5-
import org.utbot.framework.plugin.api.FieldId
65
import org.utbot.framework.plugin.api.UtClusterInfo
76
import org.utbot.framework.plugin.api.UtExecution
87
import org.utbot.framework.plugin.api.UtExecutionFailure
@@ -12,51 +11,28 @@ import org.utbot.framework.plugin.api.UtSymbolicExecution
1211
import org.utbot.framework.plugin.api.util.objectClassId
1312
import org.utbot.framework.plugin.api.util.voidClassId
1413
import org.utbot.fuzzer.UtFuzzedExecution
15-
import soot.jimple.JimpleBody
1614

1715
data class CgMethodTestSet constructor(
1816
val executableId: ExecutableId,
19-
val jimpleBody: JimpleBody? = null,
2017
val errors: Map<String, Int> = emptyMap(),
2118
val clustersInfo: List<Pair<UtClusterInfo?, IntRange>>,
2219
) {
2320
var executions: List<UtExecution> = emptyList()
2421
private set
2522

26-
constructor(from: UtMethodTestSet) : this(
27-
from.method,
28-
from.jimpleBody,
29-
from.errors,
30-
from.clustersInfo
31-
) {
23+
constructor(from: UtMethodTestSet) : this(from.method, from.errors) {
3224
executions = from.executions
3325
}
26+
3427
/**
35-
* For JavaScript purposes.
28+
* Constructor for JavaScript and Python purposes.
3629
*/
3730
constructor(
3831
executableId: ExecutableId,
39-
execs: List<UtExecution> = emptyList(),
40-
errors: Map<String, Int> = emptyMap()
41-
) : this(
42-
executableId,
43-
null,
44-
errors,
45-
listOf(null to execs.indices)
46-
) {
47-
executions = execs
48-
}
49-
50-
constructor(
51-
executableId: ExecutableId,
32+
errors: Map<String, Int> = emptyMap(),
5233
executions: List<UtExecution> = emptyList(),
53-
) : this(
54-
executableId,
55-
null,
56-
emptyMap(),
57-
58-
listOf(null to executions.indices)
59-
) {
34+
clustersInfo: List<Pair<UtClusterInfo?, IntRange>> = listOf(null to executions.indices),
35+
) : this(executableId, errors, clustersInfo) {
6036
this.executions = executions
6137
}
6238

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ open class CgTestClassConstructor(val context: CgContext) :
173173
testSet: CgMethodTestSet,
174174
regions: MutableList<CgRegion<CgMethod>>
175175
) {
176-
val (methodUnderTest, _, _, clustersInfo) = testSet
176+
val (methodUnderTest, _, clustersInfo) = testSet
177177

178178
for ((clusterSummary, executionIndices) in clustersInfo) {
179179
val currentTestCaseTestMethods = mutableListOf<CgTestMethod>()
@@ -208,7 +208,7 @@ open class CgTestClassConstructor(val context: CgContext) :
208208
testSet: CgMethodTestSet,
209209
regions: MutableList<CgRegion<CgMethod>>
210210
) {
211-
val (methodUnderTest, _, _, _) = testSet
211+
val (methodUnderTest, _, _) = testSet
212212

213213
for (preparedTestSet in testSet.prepareTestSetsForParameterizedTestGeneration()) {
214214
val dataProviderMethodName = nameGenerator.dataProviderMethodNameFor(preparedTestSet.executableId)

utbot-js/src/main/kotlin/api/JsTestGenerator.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class JsTestGenerator(
162162
)
163163
}
164164
val testSet = CgMethodTestSet(
165-
execId,
166-
testsForGenerator,
167-
errorsForGenerator
165+
executableId = execId,
166+
errors = errorsForGenerator,
167+
executions = testsForGenerator,
168168
)
169169
testSets += testSet
170170
paramNames[execId] = funcNode.parameters.map { it.name.toString() }

utbot-python/src/main/kotlin/org/utbot/python/PythonTestGenerationProcessor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ object PythonTestGenerationProcessor {
187187
val testCode = codegen.pythonGenerateAsStringWithTestReport(
188188
notEmptyTests.map { testSet ->
189189
CgMethodTestSet(
190-
methodIds[testSet.method] as ExecutableId,
191-
testSet.executions
190+
executableId = methodIds[testSet.method] as ExecutableId,
191+
executions = testSet.executions
192192
)
193193
},
194194
allImports

0 commit comments

Comments
 (0)