Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide references to invoked methods in summary #476

Merged
merged 4 commits into from
Jul 18, 2022
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 @@ -141,7 +141,7 @@ internal class SortTest : UtValueTestCaseChecker(testClass = Sort::class) {
DocCodeStmt("(array.length < 4): False"),
DocRegularStmt("\n"),
DocRegularStmt("invokes:\n"),
DocRegularStmt(" Arrays::sort once"),
DocRegularStmt(" {@link java.util.Arrays#sort(int[])} once"),
DocRegularStmt("\n"),
DocRegularStmt("returns from: "),
DocCodeStmt("return array;"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(

@Test
fun testInnerVoidCompareChars() {
val summary1 = "Test calls ReturnExample::compareChars,\n" +
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): True\n" +
" returns from: return ' ';\n" +
" " // TODO: generates empty String or \n a the end
val summary2 = "Test calls ReturnExample::compareChars,\n" +
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
" inside this loop, the test executes conditions:\n" +
" (Character.toChars(i)[0] == a): True\n" +
" returns from: return b;"
val summary3 = "Test calls ReturnExample::compareChars,\n" +
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
Expand All @@ -186,7 +186,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
" (Character.toChars(i)[0] == b): False\n" +
" Test then returns from: return a;\n" +
" " // TODO: generates empty String or \n a the end
val summary4 = "Test calls ReturnExample::compareChars,\n" +
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
Expand Down Expand Up @@ -235,21 +235,21 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(

@Test
fun testInnerReturnCompareChars() {
val summary1 = "Test calls ReturnExample::compareChars,\n" +
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): True\n" +
" returns from: return ' ';\n" +
" \n" +
"Test later returns from: return compareChars(a, b, n);\n"
val summary2 = "Test calls ReturnExample::compareChars,\n" +
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
" inside this loop, the test executes conditions:\n" +
" (Character.toChars(i)[0] == a): True\n" +
" returns from: return b;\n" +
"Test later returns from: return compareChars(a, b, n);\n"
val summary3 = "Test calls ReturnExample::compareChars,\n" +
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
Expand All @@ -259,7 +259,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
" Test then returns from: return a;\n" +
" \n" + //
"Test afterwards returns from: return compareChars(a, b, n);\n"
val summary4 = "Test calls ReturnExample::compareChars,\n" +
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compareChars(char,char,int)},\n" +
" there it executes conditions:\n" +
" (n < 1): False\n" +
" iterates the loop for(int i = 0; i < n; i++) once,\n" +
Expand Down Expand Up @@ -309,33 +309,33 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(

@Test
fun testInnerVoidCompare() {
val summary1 = "Test calls ReturnExample::compare,\n" +
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): True\n" +
" returns from: return a;\n" +
" " // TODO: remove blank line
val summary2 = "Test calls ReturnExample::compare,\n" +
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
" (b == 10): False,\n" +
" (a > b): True\n" +
" returns from: return b;\n" +
" " // TODO: remove blank line
val summary3 = "Test calls ReturnExample::compare,\n" +
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
" (b == 10): True\n" +
" returns from: return c;\n" +
" " // TODO: remove blank line
val summary4 = "Test calls ReturnExample::compare,\n" +
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): True\n" +
" returns from: return a;\n" +
" " // TODO: remove blank line
val summary5 = "Test calls ReturnExample::compare,\n" +
val summary5 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
Expand All @@ -344,7 +344,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
" (a < b): True\n" +
" returns from: return a;\n" +
" " // TODO: remove blank line
val summary6 = "Test calls ReturnExample::compare,\n" +
val summary6 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
Expand Down Expand Up @@ -404,14 +404,14 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(

@Test
fun testInnerReturnCompare() {
val summary1 = "Test calls ReturnExample::compare,\n" +
val summary1 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): True\n" +
" returns from: return a;\n" +
" \n" +
"Test then returns from: return compare(a, b);\n"
val summary2 = "Test calls ReturnExample::compare,\n" +
val summary2 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
Expand All @@ -420,21 +420,21 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
" returns from: return b;\n" +
" \n" +
"Test afterwards returns from: return compare(a, b);\n"
val summary3 = "Test calls ReturnExample::compare,\n" +
val summary3 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
" (b == 10): True\n" +
" returns from: return c;\n" +
" \n" +
"Test then returns from: return compare(a, b);\n"
val summary4 = "Test calls ReturnExample::compare,\n" +
val summary4 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): True\n" +
" returns from: return a;\n" +
" \n" +
"Test next returns from: return compare(a, b);\n"
val summary5 = "Test calls ReturnExample::compare,\n" +
val summary5 = "Test calls{@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
Expand All @@ -444,7 +444,7 @@ class SummaryReturnExampleTest : SummaryTestCaseGeneratorTest(
" returns from: return a;\n" +
" \n" +
"Test afterwards returns from: return compare(a, b);\n"
val summary6 = "Test calls ReturnExample::compare,\n" +
val summary6 = "Test calls {@link org.utbot.examples.algorithms.ReturnExample#compare(int,int)},\n" +
" there it executes conditions:\n" +
" (a < 0): False,\n" +
" (b < 0): False,\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SummaryListWrapperReturnsVoidTest : SummaryTestCaseGeneratorTest(
" sum[0] += i;\n" +
" }\n" +
"});"
val summary2 = "Test invokes: List::forEach once\n" +
val summary2 = "Test invokes: {@link java.util.List#forEach(java.util.function.Consumer)} once\n" +
"throws NullPointerException in: list.forEach(i -> {\n" +
" if (i > 0) {\n" +
" sum[0] += i;\n" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package examples.controlflow

import examples.SummaryTestCaseGeneratorTest
import org.junit.Ignore
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Tag
import org.utbot.examples.controlflow.Cycles
import org.junit.jupiter.api.Test
import org.utbot.examples.DoNotCalculate
import org.utbot.examples.algorithms.ReturnExample
import org.utbot.examples.controlflow.Cycles
import org.utbot.framework.plugin.api.MockStrategyApi

class SummaryCycleTest : SummaryTestCaseGeneratorTest(
Expand All @@ -19,7 +15,8 @@ class SummaryCycleTest : SummaryTestCaseGeneratorTest(
" inside this loop, the test executes conditions:\n" +
" (i < 0): True\n" +
"returns from: return 2;"
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?
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?
val summary3 = "Test iterates the loop for(int i = x - 5; i < x; i++) once,\n" +
" inside this loop, the test executes conditions:\n" +
" (i < 0): False\n" +
Expand Down Expand Up @@ -123,7 +120,7 @@ class SummaryCycleTest : SummaryTestCaseGeneratorTest(
methodName3
)

val method = Cycles::structureLoop
val method = Cycles::structureLoop
val mockStrategy = MockStrategyApi.NO_MOCKS
val coverage = DoNotCalculate

Expand Down
Loading