Skip to content

Commit f5534cd

Browse files
authored
Provide references to invoked methods in summary (#476)
* Add a reference (@link) to the invoked method to summary * Simplify code * Fix broken test * Fix broken test
1 parent 0a4ac22 commit f5534cd

File tree

11 files changed

+225
-202
lines changed

11 files changed

+225
-202
lines changed

utbot-framework/src/test/kotlin/org/utbot/examples/algorithms/SortTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ internal class SortTest : UtValueTestCaseChecker(testClass = Sort::class) {
141141
DocCodeStmt("(array.length < 4): False"),
142142
DocRegularStmt("\n"),
143143
DocRegularStmt("invokes:\n"),
144-
DocRegularStmt(" Arrays::sort once"),
144+
DocRegularStmt(" {@link java.util.Arrays#sort(int[])} once"),
145145
DocRegularStmt("\n"),
146146
DocRegularStmt("returns from: "),
147147
DocCodeStmt("return array;"),

utbot-summary-tests/src/test/kotlin/examples/algorithms/SummaryReturnExampleTest.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
165165

166166
@Test
167167
fun testInnerVoidCompareChars() {
168-
val summary1 = "Test calls ReturnExample::compareChars,\n" +
168+
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
169169
" there it executes conditions:\n" +
170170
" (n < 1): True\n" +
171171
" returns from: return ' ';\n" +
172172
" " // TODO: generates empty String or \n a the end
173-
val summary2 = "Test calls ReturnExample::compareChars,\n" +
173+
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
174174
" there it executes conditions:\n" +
175175
" (n < 1): False\n" +
176176
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
177177
" inside this loop, the test executes conditions:\n" +
178178
" (Character.toChars(i)[0] == a): True\n" +
179179
" returns from: return b;"
180-
val summary3 = "Test calls ReturnExample::compareChars,\n" +
180+
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
181181
" there it executes conditions:\n" +
182182
" (n < 1): False\n" +
183183
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
@@ -186,7 +186,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
186186
" (Character.toChars(i)[0] == b): False\n" +
187187
" Test then returns from: return a;\n" +
188188
" " // TODO: generates empty String or \n a the end
189-
val summary4 = "Test calls ReturnExample::compareChars,\n" +
189+
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
190190
" there it executes conditions:\n" +
191191
" (n < 1): False\n" +
192192
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
@@ -235,21 +235,21 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
235235

236236
@Test
237237
fun testInnerReturnCompareChars() {
238-
val summary1 = "Test calls ReturnExample::compareChars,\n" +
238+
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
239239
" there it executes conditions:\n" +
240240
" (n < 1): True\n" +
241241
" returns from: return ' ';\n" +
242242
" \n" +
243243
"Test later returns from: return compareChars(a, b, n);\n"
244-
val summary2 = "Test calls ReturnExample::compareChars,\n" +
244+
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
245245
" there it executes conditions:\n" +
246246
" (n < 1): False\n" +
247247
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
248248
" inside this loop, the test executes conditions:\n" +
249249
" (Character.toChars(i)[0] == a): True\n" +
250250
" returns from: return b;\n" +
251251
"Test later returns from: return compareChars(a, b, n);\n"
252-
val summary3 = "Test calls ReturnExample::compareChars,\n" +
252+
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
253253
" there it executes conditions:\n" +
254254
" (n < 1): False\n" +
255255
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
@@ -259,7 +259,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
259259
" Test then returns from: return a;\n" +
260260
" \n" + //
261261
"Test afterwards returns from: return compareChars(a, b, n);\n"
262-
val summary4 = "Test calls ReturnExample::compareChars,\n" +
262+
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
263263
" there it executes conditions:\n" +
264264
" (n < 1): False\n" +
265265
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
@@ -309,33 +309,33 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
309309

310310
@Test
311311
fun testInnerVoidCompare() {
312-
val summary1 = "Test calls ReturnExample::compare,\n" +
312+
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
313313
" there it executes conditions:\n" +
314314
" (a < 0): False,\n" +
315315
" (b < 0): True\n" +
316316
" returns from: return a;\n" +
317317
" " // TODO: remove blank line
318-
val summary2 = "Test calls ReturnExample::compare,\n" +
318+
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
319319
" there it executes conditions:\n" +
320320
" (a < 0): False,\n" +
321321
" (b < 0): False,\n" +
322322
" (b == 10): False,\n" +
323323
" (a > b): True\n" +
324324
" returns from: return b;\n" +
325325
" " // TODO: remove blank line
326-
val summary3 = "Test calls ReturnExample::compare,\n" +
326+
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
327327
" there it executes conditions:\n" +
328328
" (a < 0): False,\n" +
329329
" (b < 0): False,\n" +
330330
" (b == 10): True\n" +
331331
" returns from: return c;\n" +
332332
" " // TODO: remove blank line
333-
val summary4 = "Test calls ReturnExample::compare,\n" +
333+
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
334334
" there it executes conditions:\n" +
335335
" (a < 0): True\n" +
336336
" returns from: return a;\n" +
337337
" " // TODO: remove blank line
338-
val summary5 = "Test calls ReturnExample::compare,\n" +
338+
val summary5 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
339339
" there it executes conditions:\n" +
340340
" (a < 0): False,\n" +
341341
" (b < 0): False,\n" +
@@ -344,7 +344,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
344344
" (a < b): True\n" +
345345
" returns from: return a;\n" +
346346
" " // TODO: remove blank line
347-
val summary6 = "Test calls ReturnExample::compare,\n" +
347+
val summary6 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
348348
" there it executes conditions:\n" +
349349
" (a < 0): False,\n" +
350350
" (b < 0): False,\n" +
@@ -404,14 +404,14 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
404404

405405
@Test
406406
fun testInnerReturnCompare() {
407-
val summary1 = "Test calls ReturnExample::compare,\n" +
407+
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
408408
" there it executes conditions:\n" +
409409
" (a < 0): False,\n" +
410410
" (b < 0): True\n" +
411411
" returns from: return a;\n" +
412412
" \n" +
413413
"Test then returns from: return compare(a, b);\n"
414-
val summary2 = "Test calls ReturnExample::compare,\n" +
414+
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
415415
" there it executes conditions:\n" +
416416
" (a < 0): False,\n" +
417417
" (b < 0): False,\n" +
@@ -420,21 +420,21 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
420420
" returns from: return b;\n" +
421421
" \n" +
422422
"Test afterwards returns from: return compare(a, b);\n"
423-
val summary3 = "Test calls ReturnExample::compare,\n" +
423+
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
424424
" there it executes conditions:\n" +
425425
" (a < 0): False,\n" +
426426
" (b < 0): False,\n" +
427427
" (b == 10): True\n" +
428428
" returns from: return c;\n" +
429429
" \n" +
430430
"Test then returns from: return compare(a, b);\n"
431-
val summary4 = "Test calls ReturnExample::compare,\n" +
431+
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
432432
" there it executes conditions:\n" +
433433
" (a < 0): True\n" +
434434
" returns from: return a;\n" +
435435
" \n" +
436436
"Test next returns from: return compare(a, b);\n"
437-
val summary5 = "Test calls ReturnExample::compare,\n" +
437+
val summary5 = "Test calls{@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
438438
" there it executes conditions:\n" +
439439
" (a < 0): False,\n" +
440440
" (b < 0): False,\n" +
@@ -444,7 +444,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
444444
" returns from: return a;\n" +
445445
" \n" +
446446
"Test afterwards returns from: return compare(a, b);\n"
447-
val summary6 = "Test calls ReturnExample::compare,\n" +
447+
val summary6 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
448448
" there it executes conditions:\n" +
449449
" (a < 0): False,\n" +
450450
" (b < 0): False,\n" +

utbot-summary-tests/src/test/kotlin/examples/collections/SummaryListWrapperReturnsVoidTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class SummaryListWrapperReturnsVoidTest : SummaryTestCaseGeneratorTest(
6969
" sum[0] += i;\n" +
7070
" }\n" +
7171
"});"
72-
val summary2 = "Test invokes: List::forEach once\n" +
72+
val summary2 = "Test invokes: {@link java.util.List#forEach(java.util.function.Consumer)} once\n" +
7373
"throws NullPointerException in: list.forEach(i -> {\n" +
7474
" if (i > 0) {\n" +
7575
" sum[0] += i;\n" +

utbot-summary-tests/src/test/kotlin/examples/controlflow/SummaryCycleTest.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package examples.controlflow
22

33
import examples.SummaryTestCaseGeneratorTest
4-
import org.junit.Ignore
5-
import org.junit.jupiter.api.Disabled
6-
import org.junit.jupiter.api.Tag
7-
import org.utbot.examples.controlflow.Cycles
84
import org.junit.jupiter.api.Test
95
import org.utbot.examples.DoNotCalculate
10-
import org.utbot.examples.algorithms.ReturnExample
6+
import org.utbot.examples.controlflow.Cycles
117
import org.utbot.framework.plugin.api.MockStrategyApi
128

139
class SummaryCycleTest : SummaryTestCaseGeneratorTest(
@@ -19,7 +15,8 @@ class SummaryCycleTest : SummaryTestCaseGeneratorTest(
1915
" inside this loop, the test executes conditions:\n" +
2016
" (i < 0): True\n" +
2117
"returns from: return 2;"
22-
val summary2 = "Test does not iterate for(int i = x - 5; i < x; i++), for(int j = i; j < x + i; j++), returns from: return -1;\n" // TODO: should it be formatted from the new string?
18+
val summary2 =
19+
"Test does not iterate for(int i = x - 5; i < x; i++), for(int j = i; j < x + i; j++), returns from: return -1;\n" // TODO: should it be formatted from the new string?
2320
val summary3 = "Test iterates the loop for(int i = x - 5; i < x; i++) once,\n" +
2421
" inside this loop, the test executes conditions:\n" +
2522
" (i < 0): False\n" +
@@ -123,7 +120,7 @@ class SummaryCycleTest : SummaryTestCaseGeneratorTest(
123120
methodName3
124121
)
125122

126-
val method = Cycles::structureLoop
123+
val method = Cycles::structureLoop
127124
val mockStrategy = MockStrategyApi.NO_MOCKS
128125
val coverage = DoNotCalculate
129126

0 commit comments

Comments
 (0)