-
Notifications
You must be signed in to change notification settings - Fork 43
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
Refactoring in Summary Module #2425
Conversation
utbot-summary-tests/src/test/kotlin/examples/controlflow/SummaryConditionsTest.kt
Outdated
Show resolved
Hide resolved
@@ -37,19 +37,19 @@ class SummaryBinarySearchTest : SummaryTestCaseGeneratorTest( | |||
"returns from: return right + 1;\n" | |||
val summary5 = "Test invokes:\n" + | |||
" org.utbot.examples.algorithms.BinarySearch#isUnsorted(long[]) once\n" + | |||
"throws NullPointerException in: isUnsorted(array)\n" | |||
"throws NullPointerException when: isUnsorted(array)\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we have a function that does not return boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have two possible cases: when we throw an exception somewhere (in this case we use "in" preposition) and when we throw depending on a condition (we use "when").
So, if isUnsorted(...)
returns not a boolean, we will use "in" preposition.
@@ -12,7 +12,7 @@ class SummarySimpleClassExampleTest : SummaryTestCaseGeneratorTest( | |||
@Test | |||
fun testImmutableFieldAccess() { | |||
val summary1 = "Test \n" + | |||
"throws NullPointerException in: c.b == 10\n" | |||
"throws NullPointerException when: c.b == 10\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question: what if it is not a condition statement, but just something else that contains exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After that, what is \n
here and for what it is here?
|
||
val displayName1 = "switch(mode) case: FLOOR -> return (Integer.SIZE - 1) - Integer.numberOfLeadingZeros(x)" | ||
val displayName2 = "switch(mode) case: CEILING -> return Integer.SIZE - Integer.numberOfLeadingZeros(x - 1)" | ||
val displayName3 = "switch(mode) case: HALF_EVEN -> return logFloor + lessThanBranchFree(cmp, x)" | ||
val displayName4 = "switch(mode) case: -> ThrowNullPointerException" | ||
val displayName4 = "switch(mode) -> ThrowNullPointerException" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that case here is unknown, we can't determine it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we try to pass null
in switch(...)
as an argument, we get "ThrowNullPointerException".
In this case we don't proceed inside the switch and the reason of an exception is switch itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a kind of genius work of digging in the shit!
Description
Fixes a bunch of bugs in Summary Module including refactoring.
This PR includes:
See #2322 (comment)
Also Fixes #2376
How to test
Automated tests
Added extra tests for Summary Module.
Manual tests
See #2322 (comment) to check that it was fixed.