Skip to content

Commit 28a3d6f

Browse files
Additional renamings
1 parent ba1ac51 commit 28a3d6f

File tree

17 files changed

+75
-67
lines changed

17 files changed

+75
-67
lines changed

utbot-cli/src/main/kotlin/org/utbot/cli/BunchTestGeneratorCommand.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ class BunchTestGeneratorCommand : GenerateTestsAbstractCommand(
104104

105105
val testClassName = "${classUnderTest.simpleName}Test"
106106

107-
val testCases = generateTestCases(
107+
val testSets = generateTestSets(
108108
targetMethods,
109109
searchDirectory = workingDirectory,
110110
chosenClassesToMockAlways = (Mocker.defaultSuperClassesToMockAlwaysNames + classesToMockAlways)
111111
.mapTo(mutableSetOf()) { ClassId(it) }
112112
)
113113

114-
val testClassBody = generateTest(classUnderTest, testClassName, testCases)
114+
val testClassBody = generateTest(classUnderTest, testClassName, testSets)
115115

116116
val outputArgAsFile = File(output ?: "")
117117
if (!outputArgAsFile.exists()) {

utbot-cli/src/main/kotlin/org/utbot/cli/GenerateTestsAbstractCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ abstract class GenerateTestsAbstractCommand(name: String, help: String) :
153153
protected fun loadClassBySpecifiedFqn(classFqn: String): KClass<*> =
154154
classLoader.loadClass(classFqn).kotlin
155155

156-
protected fun generateTestCases(
156+
protected fun generateTestSets(
157157
targetMethods: List<UtMethod<*>>,
158158
sourceCodeFile: Path? = null,
159159
searchDirectory: Path,

utbot-cli/src/main/kotlin/org/utbot/cli/GenerateTestsCommand.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,20 @@ class GenerateTestsCommand :
102102

103103
val testClassName = output?.toPath()?.toFile()?.nameWithoutExtension
104104
?: "${classUnderTest.simpleName}Test"
105-
val testCases = generateTestCases(
105+
val testSets = generateTestSets(
106106
targetMethods,
107107
Paths.get(sourceCodeFile),
108108
searchDirectory = workingDirectory,
109109
chosenClassesToMockAlways = (Mocker.defaultSuperClassesToMockAlwaysNames + classesToMockAlways)
110110
.mapTo(mutableSetOf()) { ClassId(it) }
111111
)
112-
val testClassBody = generateTest(classUnderTest, testClassName, testCases)
112+
val testClassBody = generateTest(classUnderTest, testClassName, testSets)
113113

114114
if (printToStdOut) {
115115
logger.info { testClassBody }
116116
}
117117
if (sarifReport != null) {
118-
generateReport(targetClassFqn, testCases, testClassBody)
118+
generateReport(targetClassFqn, testSets, testClassBody)
119119
}
120120
saveToFile(testClassBody, output)
121121
}

utbot-framework/src/main/kotlin/org/utbot/engine/DataClasses.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,15 @@ data class GraphResult(
158158
val constraints: Set<UtBoolExpression> = emptySet()
159159
) : InvokeResult()
160160

161-
data class Environment(var method: SootMethod, var state: ExecutionState)
161+
class Environment(
162+
var method: SootMethod,
163+
var state: ExecutionState
164+
) {
165+
val solver by state::solver
166+
val memory by state::memory
167+
val localVariableMemory by state::localVariableMemory
168+
169+
}
162170

163171
data class Step(
164172
val stmt: Stmt,

utbot-framework/src/main/kotlin/org/utbot/engine/Traverser.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ class Traverser(
215215
// TODO: move this and other mutable fields to [TraversalContext]
216216
lateinit var environment: Environment
217217
private val solver: UtSolver
218-
get() = environment.state.solver
218+
get() = environment.solver
219219

220220
// TODO HACK violation of encapsulation
221221
val memory: Memory
222-
get() = environment.state.memory
222+
get() = environment.memory
223223

224224
private val localVariableMemory: LocalVariableMemory
225-
get() = environment.state.localVariableMemory
225+
get() = environment.localVariableMemory
226226

227227
//HACK (long strings)
228228
internal var softMaxArraySize = 40

utbot-framework/src/main/kotlin/org/utbot/external/api/UtBotJavaApi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ object UtBotJavaApi {
108108
*/
109109
@JvmStatic
110110
@JvmOverloads
111-
fun generateTestCases(
111+
fun generateTestSets(
112112
methodsForAutomaticGeneration: List<TestMethodInfo>,
113113
classUnderTest: Class<*>,
114114
classpath: String,
@@ -146,7 +146,7 @@ object UtBotJavaApi {
146146
/**
147147
* Generates test cases using only fuzzing workflow.
148148
*
149-
* @see [generateTestCases]
149+
* @see [generateTestSets]
150150
*/
151151
@JvmStatic
152152
@JvmOverloads

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ internal class CgTestClassConstructor(val context: CgContext) :
5050
id = currentTestClass
5151
body = buildTestClassBody {
5252
cgDataProviderMethods.clear()
53-
for (testCase in testSets) {
54-
updateCurrentExecutable(testCase.method)
55-
val currentMethodUnderTestRegions = construct(testCase)
53+
for (testSet in testSets) {
54+
updateCurrentExecutable(testSet.method)
55+
val currentMethodUnderTestRegions = construct(testSet)
5656
val executableUnderTestCluster = CgExecutableUnderTestCluster(
5757
"Test suites for executable $currentExecutable",
5858
currentMethodUnderTestRegions

utbot-framework/src/main/kotlin/org/utbot/framework/coverage/CoverageCalculator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ class MemoryClassLoader : ClassLoader() {
140140
}
141141
}
142142

143-
fun classCoverage(testCases: List<UtMethodValueTestSet<*>>): Coverage =
144-
testCases.map { methodCoverageWithJaCoCo(it.method, it.executions) }.toClassCoverage()
143+
fun classCoverage(testSets: List<UtMethodValueTestSet<*>>): Coverage =
144+
testSets.map { methodCoverageWithJaCoCo(it.method, it.executions) }.toClassCoverage()
145145

146146
fun methodCoverageWithJaCoCo(utMethod: UtMethod<*>, executions: List<UtValueExecution<*>>): Coverage {
147147
val methodSignature = utMethod.callable.signature

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/sarif/GenerateTestsAndSarifReportFacade.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class GenerateTestsAndSarifReportFacade(
3232
) {
3333
initializeEngine(runtimeClasspath, workingDirectory)
3434

35-
val testCases = generateTestCases(targetClass, workingDirectory)
36-
val testClassBody = generateTestCode(targetClass, testCases)
35+
val testSets = generateTestSets(targetClass, workingDirectory)
36+
val testClassBody = generateTestCode(targetClass, testSets)
3737
targetClass.testsCodeFile.writeText(testClassBody)
3838

39-
generateReport(targetClass, testCases, testClassBody, sourceFindingStrategy)
39+
generateReport(targetClass, testSets, testClassBody, sourceFindingStrategy)
4040
}
4141

4242
companion object {
@@ -69,7 +69,7 @@ class GenerateTestsAndSarifReportFacade(
6969
TestCaseGenerator.init(workingDirectory, classPath, dependencyPaths)
7070
}
7171

72-
private fun generateTestCases(targetClass: TargetClassWrapper, workingDirectory: Path): List<UtMethodTestSet> =
72+
private fun generateTestSets(targetClass: TargetClassWrapper, workingDirectory: Path): List<UtMethodTestSet> =
7373
TestCaseGenerator.generate(
7474
targetClass.targetMethods,
7575
sarifProperties.mockStrategy,

utbot-framework/src/main/kotlin/org/utbot/sarif/SarifReport.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class SarifReport(
7070
val sarifResults = mutableListOf<SarifResult>()
7171
val sarifRules = mutableSetOf<SarifRule>()
7272

73-
for (testCase in testSets) {
74-
for (execution in testCase.executions) {
73+
for (testSet in testSets) {
74+
for (execution in testSet.executions) {
7575
if (shouldProcessExecutionResult(execution.result)) {
7676
val (sarifResult, sarifRule) = processUncheckedException(
77-
method = testCase.method,
77+
method = testSet.method,
7878
utExecution = execution,
7979
uncheckedException = execution.result as UtExecutionFailure
8080
)

0 commit comments

Comments
 (0)