From e3c2890baba032753e94c9cfc8157fa487283438 Mon Sep 17 00:00:00 2001 From: amandelpie Date: Tue, 8 Nov 2022 17:44:16 +0300 Subject: [PATCH 1/2] Excluded a method name of static initializer --- .../src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt index 6972aa0395..d8250434c6 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SentenceUtil.kt @@ -93,6 +93,7 @@ val nextSynonyms = arrayOf( val skipInvokes = arrayOf( "", + "", "valueOf", "getClass" ) From 1259199fa8306596b87cfead502351d0e2fd3fb2 Mon Sep 17 00:00:00 2001 From: amandelpie Date: Fri, 16 Dec 2022 13:59:53 +0300 Subject: [PATCH 2/2] Added test for the found bug --- .../test/kotlin/math/SummaryIntMathLogTest.kt | 71 +++++++++++++++++++ ...ntMathTest.kt => SummaryIntMathPowTest.kt} | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 utbot-summary-tests/src/test/kotlin/math/SummaryIntMathLogTest.kt rename utbot-summary-tests/src/test/kotlin/math/{SummaryIntMathTest.kt => SummaryIntMathPowTest.kt} (99%) diff --git a/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathLogTest.kt b/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathLogTest.kt new file mode 100644 index 0000000000..428349c719 --- /dev/null +++ b/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathLogTest.kt @@ -0,0 +1,71 @@ +package math + +import examples.CustomJavaDocTagsEnabler +import examples.SummaryTestCaseGeneratorTest +import guava.examples.math.IntMath +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.utbot.framework.plugin.api.MockStrategyApi +import org.utbot.framework.plugin.api.UtClusterInfo +import org.utbot.testing.DoNotCalculate + +@ExtendWith(CustomJavaDocTagsEnabler::class) +class SummaryIntMathLogTest : SummaryTestCaseGeneratorTest( + IntMath::class, +) { + @Test + fun testLog2() { + val summary1 = "@utbot.classUnderTest {@link IntMath}\n" + + "@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n" + val summary2 = "@utbot.classUnderTest {@link IntMath}\n" + + "@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n" + val summary3 = "@utbot.classUnderTest {@link IntMath}\n" + + "@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n" + val summary4 = "@utbot.classUnderTest {@link IntMath}\n" + + "@utbot.methodUnderTest {@link guava.examples.math.IntMath#log2(int,java.math.RoundingMode)}\n" + + "@utbot.invokes {@link java.math.RoundingMode#ordinal()}\n" + + "@utbot.throwsException {@link java.lang.NullPointerException} in: mode" + + val methodName1 = "testLog2" + val methodName2 = "testLog2_1" + val methodName3 = "testLog2_2" + val methodName4 = "testLog2_RoundingModeOrdinal" + + val displayName1 = "" + val displayName2 = "" + val displayName3 = "" + val displayName4 = "switch(mode) case: -> ThrowNullPointerException" + + val summaryKeys = listOf( + summary1, + summary2, + summary3, + summary4 + ) + + val displayNames = listOf( + displayName1, + displayName2, + displayName3, + displayName4 + ) + + val methodNames = listOf( + methodName1, + methodName2, + methodName3, + methodName4 + ) + + val clusterInfo = listOf( + Pair(UtClusterInfo("SYMBOLIC EXECUTION: SUCCESSFUL EXECUTIONS for method log2(int, java.math.RoundingMode)", null), 3), + Pair(UtClusterInfo("SYMBOLIC EXECUTION: ERROR SUITE for method log2(int, java.math.RoundingMode)", null), 1) + ) + + val method = IntMath::log2 + val mockStrategy = MockStrategyApi.NO_MOCKS + val coverage = DoNotCalculate + + summaryCheck(method, mockStrategy, coverage, summaryKeys, methodNames, displayNames, clusterInfo) + } +} \ No newline at end of file diff --git a/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathTest.kt b/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathPowTest.kt similarity index 99% rename from utbot-summary-tests/src/test/kotlin/math/SummaryIntMathTest.kt rename to utbot-summary-tests/src/test/kotlin/math/SummaryIntMathPowTest.kt index a5e4319e12..fc362d5edc 100644 --- a/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathTest.kt +++ b/utbot-summary-tests/src/test/kotlin/math/SummaryIntMathPowTest.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test import org.utbot.framework.plugin.api.MockStrategyApi import org.utbot.framework.plugin.api.UtClusterInfo import org.utbot.testing.DoNotCalculate -class SummaryIntMathTest : SummaryTestCaseGeneratorTest( +class SummaryIntMathPowTest : SummaryTestCaseGeneratorTest( IntMath::class, ) { @Test