File tree 2 files changed +13
-1
lines changed
utbot-summary/src/main/kotlin/org/utbot/summary/comment
utbot-summary-tests/src/test/kotlin/examples/recursion
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
26
26
val summary3 = " @utbot.classUnderTest {@link Recursion}\n " +
27
27
" @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n " +
28
28
" @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;}" +
29
32
" @utbot.returnsFrom {@code return fib(n - 1) + fib(n - 2);}"
30
33
val summary4 = " @utbot.classUnderTest {@link Recursion}\n " +
31
34
" @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#fib(int)}\n " +
@@ -81,6 +84,7 @@ class SummaryRecursionTest : SummaryTestCaseGeneratorTest(
81
84
val summary2 = " @utbot.classUnderTest {@link Recursion}\n " +
82
85
" @utbot.methodUnderTest {@link org.utbot.examples.recursion.Recursion#factorial(int)}\n " +
83
86
" @utbot.executesCondition {@code (n == 0): False}\n " +
87
+ " @utbot.triggersRecursion factorial, where the test return from: {@code return 1;}" +
84
88
" @utbot.returnsFrom {@code return n * factorial(n - 1);}"
85
89
val summary3 = " @utbot.classUnderTest {@link Recursion}\n " +
86
90
" @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
3
3
import org.utbot.framework.plugin.api.DocCustomTagStatement
4
4
import org.utbot.framework.plugin.api.DocStatement
5
5
import org.utbot.framework.plugin.api.exceptionOrNull
6
- import org.utbot.summary.SummarySentenceConstants
7
6
import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN
8
7
import org.utbot.summary.ast.JimpleToASTMap
9
8
import org.utbot.summary.tag.TraceTagWithoutExecution
@@ -54,6 +53,15 @@ class CustomJavaDocCommentBuilder(
54
53
comment.throwsException = " {@link $exceptionName } $reason " .replace(CARRIAGE_RETURN , " " )
55
54
}
56
55
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
+
57
65
generateSequence(rootSentenceBlock) { it.nextBlock }.forEach {
58
66
it.stmtTexts.forEach { statement ->
59
67
processStatement(statement, comment)
You can’t perform that action at this time.
0 commit comments