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 @@ -385,9 +385,9 @@ object UtSettings : AbstractSettings(
var useSandbox by getBooleanProperty(true)

/**
* Limit for number of generated tests per method
* Limit for number of generated tests per method (in each region)
*/
var maxTestsPerMethod by getIntProperty(50)
var maxTestsPerMethodInRegion by getIntProperty(50)

/**
* Max file length for generated test file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ internal class CgTestClassConstructor(val context: CgContext) :
for ((clusterSummary, executionIndices) in clustersInfo) {
val currentTestCaseTestMethods = mutableListOf<CgTestMethod>()
emptyLineIfNeeded()
val (checkedRange, needLimitExceedingComments) = if (executionIndices.last - executionIndices.first > UtSettings.maxTestsPerMethod) {
IntRange(executionIndices.first, executionIndices.first + (UtSettings.maxTestsPerMethod - 1).coerceAtLeast(0)) to true
val (checkedRange, needLimitExceedingComments) = if (executionIndices.last - executionIndices.first >= UtSettings.maxTestsPerMethodInRegion) {
IntRange(executionIndices.first, executionIndices.first + (UtSettings.maxTestsPerMethodInRegion - 1).coerceAtLeast(0)) to true
} else {
executionIndices to false
}
Expand All @@ -189,7 +189,7 @@ internal class CgTestClassConstructor(val context: CgContext) :
currentTestCaseTestMethods += methodConstructor.createTestMethod(methodUnderTest, testSet.executions[i])
}

val comments = listOf("Actual number of generated tests (${executionIndices.last - executionIndices.first}) exceeds per-method limit (${UtSettings.maxTestsPerMethod})",
val comments = listOf("Actual number of generated tests (${executionIndices.last - executionIndices.first}) exceeds per-method limit (${UtSettings.maxTestsPerMethodInRegion})",
"The limit can be configured in '{HOME_DIR}/.utbot/settings.properties' with 'maxTestsPerMethod' property")

val clusterHeader = clusterSummary?.header
Expand Down