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 @@ -26,6 +26,9 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
val summary3 = "@utbot.classUnderTest {@link Recursion}\n" +
"@utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n" +
"@utbot.executesCondition {@code (n == 1): False}\n" +
"@utbot.triggersRecursion fib, where the test execute conditions:\n" +
" {@code (n == 1): True}\n" +
"return from: {@code return 1;}" +
"@utbot.returnsFrom {@code return fib(n - 1) + fib(n - 2);}"
val summary4 = "@utbot.classUnderTest {@link Recursion}\n" +
"@utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n" +
Expand Down Expand Up @@ -81,6 +84,7 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
val summary2 = "@utbot.classUnderTest {@link Recursion}\n" +
"@utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#factorial(int)}\n" +
"@utbot.executesCondition {@code (n == 0): False}\n" +
"@utbot.triggersRecursion factorial, where the test return from: {@code return 1;}" +
"@utbot.returnsFrom {@code return n * factorial(n - 1);}"
val summary3 = "@utbot.classUnderTest {@link Recursion}\n" +
"@utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#factorial(int)}\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.utbot.summary.comment
import org.utbot.framework.plugin.api.DocCustomTagStatement
import org.utbot.framework.plugin.api.DocStatement
import org.utbot.framework.plugin.api.exceptionOrNull
import org.utbot.summary.SummarySentenceConstants
import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN
import org.utbot.summary.ast.JimpleToASTMap
import org.utbot.summary.tag.TraceTagWithoutExecution
Expand Down Expand Up @@ -54,6 +53,15 @@ class CustomJavaDocCommentBuilder(
comment.throwsException = "{@link $exceptionName} $reason".replace(CARRIAGE_RETURN, "")
}

if (rootSentenceBlock.recursion != null) {
comment.recursion += rootSentenceBlock.recursion?.first
val insideRecursionSentence = rootSentenceBlock.recursion?.second?.toSentence()
if (!insideRecursionSentence.isNullOrEmpty()) {
comment.recursion += stringTemplates.insideRecursionSentence.format(insideRecursionSentence)
.replace(CARRIAGE_RETURN, "").trim()
}
}

generateSequence(rootSentenceBlock) { it.nextBlock }.forEach {
it.stmtTexts.forEach { statement ->
processStatement(statement, comment)
Expand Down