Skip to content

Commit 72b8c13

Browse files
Cleanup CgMethodTestSet class (#1367)
1 parent 1bffdac commit 72b8c13

File tree

4 files changed

+13
-36
lines changed

4 files changed

+13
-36
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgMethodTestSet.kt

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,28 @@ import org.utbot.framework.plugin.api.UtSymbolicExecution
1111
import org.utbot.framework.plugin.api.util.objectClassId
1212
import org.utbot.framework.plugin.api.util.voidClassId
1313
import org.utbot.fuzzer.UtFuzzedExecution
14-
import soot.jimple.JimpleBody
1514

1615
data class CgMethodTestSet constructor(
1716
val executableId: ExecutableId,
18-
val jimpleBody: JimpleBody? = null,
1917
val errors: Map<String, Int> = emptyMap(),
2018
val clustersInfo: List<Pair<UtClusterInfo?, IntRange>>,
2119
) {
2220
var executions: List<UtExecution> = emptyList()
2321
private set
2422

25-
constructor(from: UtMethodTestSet) : this(
26-
from.method,
27-
from.jimpleBody,
28-
from.errors,
29-
from.clustersInfo
30-
) {
23+
constructor(from: UtMethodTestSet) : this(from.method, from.errors, from.clustersInfo) {
3124
executions = from.executions
3225
}
26+
3327
/**
34-
* For JavaScript purposes.
28+
* Constructor for JavaScript and Python purposes.
3529
*/
3630
constructor(
3731
executableId: ExecutableId,
38-
execs: List<UtExecution> = emptyList(),
39-
errors: Map<String, Int> = emptyMap()
40-
) : this(
41-
executableId,
42-
null,
43-
errors,
44-
listOf(null to execs.indices)
45-
) {
46-
executions = execs
47-
}
48-
49-
constructor(
50-
executableId: ExecutableId,
32+
errors: Map<String, Int> = emptyMap(),
5133
executions: List<UtExecution> = emptyList(),
52-
) : this(
53-
executableId,
54-
null,
55-
emptyMap(),
56-
57-
listOf(null to executions.indices)
58-
) {
34+
clustersInfo: List<Pair<UtClusterInfo?, IntRange>> = listOf(null to executions.indices),
35+
) : this(executableId, errors, clustersInfo) {
5936
this.executions = executions
6037
}
6138

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/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)