File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
utbot-summary-tests/src/test/kotlin/examples/recursion
utbot-summary/src/main/kotlin/org/utbot/summary/comment Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
2626 val summary3 = " @utbot.classUnderTest {@link Recursion}\n " +
2727 " @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n " +
2828 " @utbot.executesCondition {@code (n == 1): False}\n " +
29+ " @utbot.triggersRecursion fib, where the test execute conditions:\n " +
30+ " {@code (n == 1): True}\n " +
31+ " return from: {@code return 1;}" +
2932 " @utbot.returnsFrom {@code return fib(n - 1) + fib(n - 2);}"
3033 val summary4 = " @utbot.classUnderTest {@link Recursion}\n " +
3134 " @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n " +
@@ -81,6 +84,7 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
8184 val summary2 = " @utbot.classUnderTest {@link Recursion}\n " +
8285 " @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#factorial(int)}\n " +
8386 " @utbot.executesCondition {@code (n == 0): False}\n " +
87+ " @utbot.triggersRecursion factorial, where the test return from: {@code return 1;}" +
8488 " @utbot.returnsFrom {@code return n * factorial(n - 1);}"
8589 val summary3 = " @utbot.classUnderTest {@link Recursion}\n " +
8690 " @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#factorial(int)}\n " +
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package org.utbot.summary.comment
33import org.utbot.framework.plugin.api.DocCustomTagStatement
44import org.utbot.framework.plugin.api.DocStatement
55import org.utbot.framework.plugin.api.exceptionOrNull
6- import org.utbot.summary.SummarySentenceConstants
76import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN
87import org.utbot.summary.ast.JimpleToASTMap
98import org.utbot.summary.tag.TraceTagWithoutExecution
@@ -54,6 +53,15 @@ class CustomJavaDocCommentBuilder(
5453 comment.throwsException = " {@link $exceptionName } $reason " .replace(CARRIAGE_RETURN , " " )
5554 }
5655
56+ if (rootSentenceBlock.recursion != null ) {
57+ comment.recursion + = rootSentenceBlock.recursion?.first
58+ val insideRecursionSentence = rootSentenceBlock.recursion?.second?.toSentence()
59+ if (! insideRecursionSentence.isNullOrEmpty()) {
60+ comment.recursion + = stringTemplates.insideRecursionSentence.format(insideRecursionSentence)
61+ .replace(CARRIAGE_RETURN , " " ).trim()
62+ }
63+ }
64+
5765 generateSequence(rootSentenceBlock) { it.nextBlock }.forEach {
5866 it.stmtTexts.forEach { statement ->
5967 processStatement(statement, comment)
You can’t perform that action at this time.
0 commit comments